#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2002
    Location
    germany
    Posts
    39
    Rep Power
    13

    Question c++ - possible to set an include path?


    hi all :)

    newbie question:

    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
    greetings
    .shapeShifter
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,648
    Rep Power
    4248
    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
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2002
    Location
    germany
    Posts
    39
    Rep Power
    13
    thx, that works.

    im using gcc for the first steps ;)
    greetings
    .shapeShifter

IMN logo majestic logo threadwatch logo seochat tools logo