Compile error no executable created
OpenLB – Open Source Lattice Boltzmann Code › Forums › on OpenLB › General Topics › Compile error no executable created
- This topic has 7 replies, 4 voices, and was last updated 4 years, 5 months ago by shreyas_ashok.
-
AuthorPosts
-
June 8, 2020 at 5:16 am #5021bioluminescenceParticipant
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 1June 8, 2020 at 11:07 am #5023robin.trunkKeymasterDear 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.1Best regards
RobinAugust 19, 2020 at 10:51 am #5100ThomasBParticipantHi 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
ThomasAugust 19, 2020 at 11:03 am #5101ThomasBParticipantRe,
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_PiAugust 19, 2020 at 4:39 pm #5102robin.trunkKeymasterDear 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
RobinAugust 20, 2020 at 10:22 am #5103ThomasBParticipantHi,
the issue is not solved with this solution 🙁
if you want to try another solution, i can do it 😉
August 20, 2020 at 3:31 pm #5104robin.trunkKeymasterHi 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
RobinSeptember 4, 2020 at 2:02 am #5113shreyas_ashokParticipantHi 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 -
AuthorPosts
- You must be logged in to reply to this topic.