July 24th, 2002, 06:02 PM
c++ - possible to set an include path?
hi all :)
is it possible to set an include path? and then every include like #include "something.h" will look for the file in /path/to/includepath/ :confused:
pls dont kick me *g*
thx for any answers
July 24th, 2002, 06:22 PM
Yes, it is possible to do so. Depending on your environment (Visual C++, Borland C++ Builder or good ol' command line g++)this is done differently.
For C++ Builder:
Go to Project-->Options. In the dialog box, click on Directories/Conditionals tab and add the directories to the Include Paths.
For Visual C++:
Go to Tools-->Options. In the dialog box, click on the Directories tab. There's a list box that shows the current list of search directories. It's not very obvious here, but if you double click on the dotted box below the last directory, it lets you add directories. (WARNING: This will be permanently set for all projects hereafter).
If you wish to set the path temporarily for one project alone, go to Project-->Settings. In the dialog box, select the C/C++ tab. In the category combo-box, select "Preprocessor" and enter the path to additional include directories in the text box labelled as such.
For g++, c++, cc or gcc:
On the command line, use -I<pathname>. For example you could typically do something like this:
g++ -I/path/to/foo rest_of_options...
Hope this helps
July 24th, 2002, 06:41 PM
thx, that works.
im using gcc for the first steps ;)