Di Miao Di Miao - 8 months ago 60
C++ Question

How to implement a github C++ library?

I am trying to use G+smo library from github. I download, unzip it and make. Then I could run all examples in the package. But there is no tutorial that guide me to build my own cpp file. For example I tried to build the simplest code from the tutorial:

# include <gismo.h>
using namespace gismo;
int main(int argc, char* argv[])
gsInfo << "Hello G+Smo.\n";
real_t a = 2.0; // a real number, ie. double
index_t b = 3; // an integer, ie. int
GISMO_ASSERT( a*b == 6, "This is an error, 2*3 should be 6.");
return 0;

And linked the lib file by -lgismo, but it says 'gismo.h: No such file or directory
compilation terminated'. I know it my be the fact that I am not familiar with c++. Can you guys give me some suggestion about it? Or, if it is overly obvious, can you just suggest me some book to read?

Thank you.


The error 'gismo.h: No such file or directory compilation terminated.' suggests that you didn't set the path where the compiler should look for the library headers. Try adding -I/path/to/gismo/headers to the compiler flags, e.g. on my system make install by default installed it to /usr/local/include/gismo so I have to add -I/usr/local/include/gismo.

By the way, there is a "tutorial": The README.txt in the deploy folder.