[Gmsh] Add gmsh in existing cmake project

Martin Vymazal martin.vymazal at vki.ac.be
Thu Jan 10 00:50:51 CET 2013


Hi Bruno,

 try to add 

 #include "MEdge.h"
 #include "MFace.h"

 at the beginning of your code to remove the errors you see. I'm not a cmake 
expert either, but I think that the recommended practice is to use 
target_link_libraries(TARGET_NAME lib1 lib2 ...) and not link_directories. 

Best regards,

   Martin Vymazal 


On Thursday 03 of January 2013 18:03:36 Bruno Correia da Silva wrote:
>  Hey guys,
> 
>   I'm newbie in CMake and linux and i'm still have problems to put
> gmsh in my project to make a call from source code.
> 
>   When I add this line in my in my root project path, in file
> CMakeLists.txt: "
> #GMSH
> SET (GMSH_LIB_PATH "/home/padmec/gmsh/lib")
> link_directories(${GMSH_LIB_PATH})
> link_libraries(Gmsh)
> SET (GMSH_INCLUDE_PATH "/home/padmec/gmsh/include/gmsh")
> include_directories(${GMSH_INCLUDE_PATH})
> "
> 
> And when i only add this lines in my cpp file:
> "
> #include "Gmsh.h"
> #include "GModel.h"
> #include "MElement.h"
> #include "MVertex.h"
> #include <iostream>
> 
> "
> Show me this error.
> "
> 
> In file included from
> /home/padmec/Downloads/Remeshing__project/src/Remover.cpp:11:0:
> /home/padmec/gmsh/include/gmsh/MElement.h: At global scope:
> /home/padmec/gmsh/include/gmsh/MElement.h:123:11: error: ‘MEdge’ does
> not name a type
> /home/padmec/gmsh/include/gmsh/MElement.h:126:34: error: ‘MEdge’ does
> not name a type
> /home/padmec/gmsh/include/gmsh/MElement.h:126:42: error: ISO C
> forbids declaration of ‘edge’ with no type [-fpermissive]
> /home/padmec/gmsh/include/gmsh/MElement.h:143:11: error: ‘MFace’ does
> not name a type
> /home/padmec/gmsh/include/gmsh/MElement.h:146:34: error: ‘MFace’ does
> not name a type
> /home/padmec/gmsh/include/gmsh/MElement.h:146:42: error: ISO C
> forbids declaration of ‘face’ with no type [-fpermissive]
> /home/padmec/gmsh/include/gmsh/MElement.h:364:11: error: ‘MEdge’ does
> not name a type
> /home/padmec/gmsh/include/gmsh/MElement.h:369:10: error: ‘MEdge’ does
> not name a type
> /home/padmec/gmsh/include/gmsh/MElement.h:382:11: error: ‘MFace’ does
> not name a type
> /home/padmec/gmsh/include/gmsh/MElement.h:387:10: error: ‘MFace’ does
> not name a type
> make[2]: Leaving directory `/home/padmec/Downloads/Remeshing__project'
> 
> "
> Let's go to the asking:
> First, someone saw this error before?
> Second,  someplace has a explicit way to add gmsh in a project using CMake?
> I saw tutorial folders in gmsh source code, but doesn't help so much.
> 
> Best regards
> att.
> Bruno Correia
> 
> _______________________________________________
> gmsh mailing list
> gmsh at geuz.org
> http://www.geuz.org/mailman/listinfo/gmsh