Reputation: 79735
I have all my project include files in a specific dir (called include
, in my project dir). When I include them in a cpp file, I need to
#include "include/somefile.h"
How can I make it so that I can do
#include <somefile.h>
?
Upvotes: 4
Views: 324
Reputation: 955
Using double quotes to include looks within the local working directory, while includes wrapped in angle brackets tell the linker/compiler to look in standard locations such as /usr/bin/ (on *nix platforms). You can tell it to look other places with the -I compiler directive (with gcc/g++ at least, IDEs like Visual Studio have their own mechanisms).
Upvotes: 2
Reputation: 84239
Use the -I
flag of the compiler. Like:
~$ c++ -Wall -Werror -pedantic -I/home/user/include -c source_file.cpp
Upvotes: 4