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
Try
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.If the path is correct
g++
should see the files.If you use absolute path in include directive, you should change quotation: