views:

116

answers:

3

I'm trying to compile a .cpp + .h file that includes newmat.h and tinyxml.h - I have libnewmat.a and libtinyxml.a in the same directory as my .cpp and .h files and I'm running

g++ -lnewmat -ltinyxml test.cpp test.h

but still getting newmat.h and tinyxml.h not found at the beginning of compilation. I'm obviously a total c++ newb because this seems like it should be trivial.

+2  A: 

The -I switch is used for that, for example:

g++ -I/usr/include -lnewmat -ltinyxml test.cpp test.h

And if you want to add a path to the Library Search-Path you use -L, for example:

g++ -L/usr/lib -lnewmat -ltinyxml test.cpp test.h
XQYZ
+4  A: 

Use the -I flag to tell it what directory to look for include files.

Laurence Gonsalves
+1  A: 

Try this one:

g++ -lnewmat -ltinyxml -I. test.cpp 

-I. to look the header files in the current folder and include your required .h in your .c files

djondal