CMU-CBML / HybridOctree_Hex

Automatic hexahedral mesh generation tool
BSD 3-Clause "New" or "Revised" License
34 stars 6 forks source link

build problem on ubuntu 22.04 #2

Closed osmanfb closed 1 month ago

osmanfb commented 8 months ago

I cloned the git repo and tried to build the code. I am getting an error during make: osman@osman-OMEN-by-HP-Laptop-17-ck1xxx:~/WORK/CarnegieMelonMeshing/HybridOctree_Hex/build$ make /usr/bin/cmake -S/home/osman/WORK/CarnegieMelonMeshing/HybridOctree_Hex/HybridOctree_Hex -B/home/osman/WORK/CarnegieMelonMeshing/HybridOctree_Hex/build --check-build-system CMakeFiles/Makefile.cmake 0 /usr/bin/cmake -E cmake_progress_start /home/osman/WORK/CarnegieMelonMeshing/HybridOctree_Hex/build/CMakeFiles /home/osman/WORK/CarnegieMelonMeshing/HybridOctree_Hex/build//CMakeFiles/progress.marks make -f CMakeFiles/Makefile2 all make[1]: Entering directory '/home/osman/WORK/CarnegieMelonMeshing/HybridOctree_Hex/build' make -f CMakeFiles/HexGen.dir/build.make CMakeFiles/HexGen.dir/depend make[2]: Entering directory '/home/osman/WORK/CarnegieMelonMeshing/HybridOctree_Hex/build' cd /home/osman/WORK/CarnegieMelonMeshing/HybridOctree_Hex/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/osman/WORK/CarnegieMelonMeshing/HybridOctree_Hex/HybridOctree_Hex /home/osman/WORK/CarnegieMelonMeshing/HybridOctree_Hex/HybridOctree_Hex /home/osman/WORK/CarnegieMelonMeshing/HybridOctree_Hex/build /home/osman/WORK/CarnegieMelonMeshing/HybridOctree_Hex/build /home/osman/WORK/CarnegieMelonMeshing/HybridOctree_Hex/build/CMakeFiles/HexGen.dir/DependInfo.cmake --color= make[2]: Leaving directory '/home/osman/WORK/CarnegieMelonMeshing/HybridOctree_Hex/build' make -f CMakeFiles/HexGen.dir/build.make CMakeFiles/HexGen.dir/build make[2]: Entering directory '/home/osman/WORK/CarnegieMelonMeshing/HybridOctree_Hex/build' [ 25%] Building CXX object CMakeFiles/HexGen.dir/Main.cpp.o /usr/bin/c++ -std=c++23 -O3 -DNDEBUG -MD -MT CMakeFiles/HexGen.dir/Main.cpp.o -MF CMakeFiles/HexGen.dir/Main.cpp.o.d -o CMakeFiles/HexGen.dir/Main.cpp.o -c /home/osman/WORK/CarnegieMelonMeshing/HybridOctree_Hex/HybridOctree_Hex/Main.cpp In file included from /home/osman/WORK/CarnegieMelonMeshing/HybridOctree_Hex/HybridOctree_Hex/HexGen.h:7, from /home/osman/WORK/CarnegieMelonMeshing/HybridOctree_Hex/HybridOctree_Hex/Main.cpp:2: /home/osman/WORK/CarnegieMelonMeshing/HybridOctree_Hex/HybridOctree_Hex/StaticVars.h:383:8: warning: extra tokens at end of #endif directive [-Wendif-labels] 383 | #endif STATICVARS_H | ^~~~ In file included from /home/osman/WORK/CarnegieMelonMeshing/HybridOctree_Hex/HybridOctree_Hex/HexGen.h:8, from /home/osman/WORK/CarnegieMelonMeshing/HybridOctree_Hex/HybridOctree_Hex/Main.cpp:2: /home/osman/WORK/CarnegieMelonMeshing/HybridOctree_Hex/HybridOctree_Hex/Mesh.h:29:8: warning: extra tokens at end of #endif directive [-Wendif-labels] 29 | #endif MESH_H | ^~ In file included from /home/osman/WORK/CarnegieMelonMeshing/HybridOctree_Hex/HybridOctree_Hex/HexGen.h:9, from /home/osman/WORK/CarnegieMelonMeshing/HybridOctree_Hex/HybridOctree_Hex/Main.cpp:2: /home/osman/WORK/CarnegieMelonMeshing/HybridOctree_Hex/HybridOctree_Hex/Initialization.h:236:8: warning: extra tokens at end of #endif directive [-Wendif-labels] 236 | #endif INITIALIZATION_H | ^~~~ In file included from /home/osman/WORK/CarnegieMelonMeshing/HybridOctree_Hex/HybridOctree_Hex/Main.cpp:2: /home/osman/WORK/CarnegieMelonMeshing/HybridOctree_Hex/HybridOctree_Hex/HexGen.h:111:8: warning: extra tokens at end of #endif directive [-Wendif-labels] 111 | #endif HEXGEN_H | ^~~~ In file included from /home/osman/WORK/CarnegieMelonMeshing/HybridOctree_Hex/HybridOctree_Hex/HexGen.h:9, from /home/osman/WORK/CarnegieMelonMeshing/HybridOctree_Hex/HybridOctree_Hex/Main.cpp:2: /home/osman/WORK/CarnegieMelonMeshing/HybridOctree_Hex/HybridOctree_Hex/Initialization.h:12:28: error: ‘sqrt’ was not declared in this scope 12 | const double DIST_THRES2 = sqrt(DIST_THRES); | ^~~~ make[2]: [CMakeFiles/HexGen.dir/build.make:79: CMakeFiles/HexGen.dir/Main.cpp.o] Error 1 make[2]: Leaving directory '/home/osman/WORK/CarnegieMelonMeshing/HybridOctree_Hex/build' make[1]: [CMakeFiles/Makefile2:86: CMakeFiles/HexGen.dir/all] Error 2 make[1]: Leaving directory '/home/osman/WORK/CarnegieMelonMeshing/HybridOctree_Hex/build' make: *** [Makefile:94: all] Error 2

Do I need a specific version of g++ ? Thnaks in advance

gt2001 commented 7 months ago

This error indicates that the sqrt function is not declared in the current scope. If you are using ubuntu, sqrt functions are mathematical functions that are typically defined in header files. You need to include the header file in the source file that calls the sqrt function. Try to add '#include \<cmath>' to Initialization.h and compile again.