Hi,
I've been working with FEniCS using Python untill now. Now I'm trying to rewrite the program in C++, but I encountered an error. My program is longer than this snippet, but gives the same error:
#include <dolfin.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include <sys/types.h>
#include <sys/stat.h>
using namespace dolfin;
int main(int argc, char* argv[])
{
std::string fileIN = "myMesh.xml";
auto mesh = std::make_shared<Mesh>(fileIN);
return 0;
}
I compile using command
g++ main.cpp -o main -std=c++11 -I/usr/include/eigen3 -lboost_system
This returns the following error:
/tmp/cckb47VS.o: In function `_ZN9__gnu_cxx13new_allocatorIN6dolfin4MeshEE9constructIS2_IPKcEEEvPT_DpOT0_':
main.cpp:(.text._ZN9__gnu_cxx13new_allocatorIN6dolfin4MeshEE9constructIS2_IPKcEEEvPT_DpOT0_[_ZN9__gnu_cxx13new_allocatorIN6dolfin4MeshEE9constructIS2_IPKcEEEvPT_DpOT0_]+0x6b): undefined reference to `dolfin::Mesh::Mesh(std::string)'
collect2: error: ld returned 1 exit status
I tried looking into directory /usr/include/dolfin/mesh/ and the file Mesh.h contains class Mesh
Also tried changing fileIN to fileIN.c_str() in the argument and the same error occured.
Also tried the Incompressible Navier-Stokes problem example here and it gave me even more errors.
My Dolfin version is 1.6.0