Skip to content

Compile error no executable created

OpenLB – Open Source Lattice Boltzmann Code Forums on OpenLB General Topics Compile error no executable created

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #5021
    bioluminescence
    Participant

    When I used the “make” command for the bstep2D example problem, I received the following error messages. Would anyone know what is missing for the “M_PI” parameter? Thanks.

    In file included from src/functors/lattice/blockLatticeLocalF3D.cpp:25:
    src/functors/lattice/blockLatticeLocalF3D.hh: In constructor ‘olb::BlockLatticePhysTauFromBoundaryDistance3D<T, DESCRIPTOR, TDESCRIPTOR>::BlockLatticePhysTauFromBoundaryDistance3D(olb::BlockLatticeStructure3D<T, DESCRIPTOR>&, olb::BlockGeometryStructure3D<T>&, const olb::XMLreader&, const olb::ThermalUnitConverter<T, DESCRIPTOR, TDESCRIPTOR>&, T, T, T, T, T, T, T, T)’:
    src/functors/lattice/blockLatticeLocalF3D.hh:1355:249: error: ‘M_PI’ was not declared in this scope
    1355 | : BlockLatticeThermalPhysF3D<T,DESCRIPTOR,TDESCRIPTOR>(blockLattice,converter,1), _blockGeometry(blockGeometry), _distanceFunctor(blockLattice, blockGeometry, xmlReader), _tmp1(lambda_0 * 287.058 * T_avg / p / c_p), _tmp2(2. * beta / (sqrt(2.) * M_PI * sigma * sigma * p * n_0 / p_0))
    | ^~~~
    make[1]: *** [Makefile:66: build/precompiled/obj/src/functors/lattice/blockLatticeLocalF3D.o] Error 1

    #5023
    robin.trunk
    Keymaster

    Dear bioluminescence,

    M_PI is a constant with the value pi. It is defined in the math.h library. So you just have to add the line
    #include<math.h>
    Which version of OpenLB are you using? I cannot reproduce the error on version 1.3.1

    Best regards
    Robin

    #5100
    ThomasB
    Participant

    Hi Robin,

    I have the same problem : M_PI not defined 🙁
    I am using 1.3r1 (with cygwin64 on windows10)

    where do i have to add the line #include <math.h> ?

    thank you
    BR
    Thomas

    #5101
    ThomasB
    Participant

    Re,

    I checked the file “blockLatticeLocalF3D.hh” : at the beginning of the file, there are the following includes
    #include<cmath>
    #include<math.h>

    so math.h is already include 🙁

    to avoid the crash, i added the following line const double M_PI = 3.14159265359; in file “blockLatticeLocalF3D.hh” just before the use of M_Pi

    #5102
    robin.trunk
    Keymaster

    Dear Thomas,

    I was not able to reproduce this exact error. Defining the constant is a good woraround. However to prevent such error in future releases, could you try to add
    #define _USE_MATH_DEFINES
    before alle the includes in this file and see if that solves the issue?

    Best regards
    Robin

    #5103
    ThomasB
    Participant

    Hi,

    the issue is not solved with this solution 🙁

    if you want to try another solution, i can do it 😉

    #5104
    robin.trunk
    Keymaster

    Hi Thomas,

    for now defining the constant seems to be the best solution.
    I will try to reproduce the issue, which compiler do you use and what is the version of your compiler and Cygwin?

    As you are using windows 10, I suggest you could also switch to the windows subsystem for linux (please see https://www.openlb.net/tech-reports/ TR5).

    Best regards
    Robin

    #5113
    shreyas_ashok
    Participant

    Hi Robin,

    Just wanted to let you know that I experienced the same issue running the laminar poiseuille2d case. I defined M_PI manually in “blockLatticeLocalF3D.hh” and it worked again.

    I’m on Windows 10 using Cygwin64. I’m using OpenLB v1.3r1.

    Thanks,
    Shreyas

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.