[Gmsh] Error linking
Agnese, Marco
m.agnese13 at imperial.ac.uk
Thu Feb 6 11:45:58 CET 2014
Hi Christophe,
I compiled the version gmsh-2.8.4-svn-20140206 with the same procedure I posted yesterday.
Then I try to run this simple code:
#include <iostream>
#include <stdio.h>
#include "Gmsh.h"
#include "GModel.h"
int main(int argc, char **argv)
{
GmshInitialize(argc, argv);
GmshSetOption("General", "Terminal", 1.);
GmshSetOption("General", "Verbosity", 99.);
GModel *m = new GModel();
m->setFactory("Gmsh");
GVertex *v1 = m->addVertex(0, 0, 0, 0.1);
GVertex *v2 = m->addVertex(1, 0, 0, 0.1);
GVertex *v3 = m->addVertex(1, 1, 0, 0.1);
GVertex *v4 = m->addVertex(0, 1, 0, 0.1);
std::vector<GEdge*> edges;
edges.push_back(m->addLine(v1, v2));
edges.push_back(m->addLine(v2, v3));
edges.push_back(m->addLine(v3, v4));
edges.push_back(m->addLine(v4, v1));
std::vector<std::vector<GEdge*> > loop;
loop.push_back(edges);
GFace *f = m->addPlanarFace(loop);
m->mesh(2);
m->writeMSH("test.msh");
delete m;
GmshFinalize();
}
It compiles correct but when I run it the code doesn't do anything. Indeed the content of test.msh is
$MeshFormat
2.2 0 8
$EndMeshFormat
$Nodes
0
$EndNodes
$Elements
0
$EndElements
.
The output of the debug is
Debug : Surface: 1
Debug : SVD : 1,1,0 (min=2)
Debug : Plane : (0 x + 0 y + 1 z = 0)
Debug : Normal : (0 , 0 , 1 )
Debug : t1 : (0 , 1 , 0 )
Debug : t2 : (1 , 0 , 0 )
Debug : pt : (0 , 0 , 0 )
Error : Mesh module not compiled
Is it a problem in compiling the library or I miss something when I link it to my own code?
Thank you very much,
Marco
________________________________________
From: Christophe Geuzaine [cgeuzaine at ulg.ac.be]
Sent: Thursday, February 06, 2014 8:18 AM
To: Agnese, Marco
Cc: gmsh at geuz.org
Subject: Re: [Gmsh] Error linking
Hi Marco,
Indeed, it's a little incompatibility in gmsh 2.8.3 - it should be fixed with the latest nightly snapshot. Can you give it a try?
Christophe
On 05 Feb 2014, at 20:20, Agnese, Marco <m.agnese13 at imperial.ac.uk> wrote:
> Hello GMSH,
> I am trying to compile a simple code which uses GMSH API.
> I compiled the GMSH source as:
>
> cmake -DDEFAULT=0 -DENABLE_BUILD_LIB=1 -DENABLE_BUILD_SHARED=1 -DENABLE_BUILD_DYNAMIC=1 -DCMAKE_INSTALL_PREFIX=../lib_install ..
> make lib
> make shared
> make install/fast
>
> and everything it is fine.
> When I compile my code with the command
>
> g++ -c -m64 -pipe -O2 -Wall -W -fPIE -I/usr/share/qt5/mkspecs/linux-g++-64 -I../gmsh_test -I../../gmsh-2.8.3-source/lib_install/include/gmsh -I. -o main.o ../gmsh_test/main.cpp
>
> and link with the command
>
> g++ -m64 -Wl,-O1 -o gmsh_test main.o -L/home/ma2413/gmsh_test/gmsh_test/../../gmsh-2.8.3-source/lib_install/lib/ -lGmsh
>
> I obtain the following errors
>
> $HOME/gmsh_test/gmsh_test/../../gmsh-2.8.3-source/lib_install/lib//libGmsh.so: undefined reference to "typeinfo for Field"
> $HOME/gmsh_test/gmsh_test/../../gmsh-2.8.3-source/lib_install/lib//libGmsh.so:undefined reference to "FieldManager::get(int)"
>
> I don't know what I am doing wrong.
>
> Thank you very much,
> regards,
> Marco.
>
> _______________________________________________
> gmsh mailing list
> gmsh at geuz.org
> http://www.geuz.org/mailman/listinfo/gmsh
--
Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science
http://www.montefiore.ulg.ac.be/~geuzaine