Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

g++ can't find headers even when it's specified

Tags:

c++

makefile

g++

So basically I have some really simple code that includes <BigIntegerLibrary.hh> which resides in /Users/wen/Projects/include/bigint. I was compiling with this:

g++ main.cpp -o Main -I/Users/wen/Projects/include/bigint

but it reported a fatal error that it could not find the file. Am I doing it right? Thanks!

main.cpp:4:10: fatal error: 'BigIntegerLibrary.hh' file not found

like image 255
ihsoy ih Avatar asked Dec 18 '12 17:12

ihsoy ih


1 Answers

Try

#include "BigIntegerLibrary.hh"

If you specify the #included file with angle brackets (#include <includeFile.h>) the compiler will try to find it in a predefined location whereas if you use #include "includeFile" the compiler first tries the paths you specified with the -I compiler option.

The -I compiler option cannot be used to specify where the <...> files are.

like image 61
René Nyffenegger Avatar answered Sep 25 '22 16:09

René Nyffenegger