Thread: newbie q: include files outside the project dir?

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    72

    newbie q: include files outside the project dir?

    ::sigh:: I know this must be documented somewhere, but I can't seem to find it, so..

    I have several .h/.C files in a common directory. I want to include them by just #include "file.h"

    Where is the setting that allows me to specify the search path for files?

    I'm using MSVC .Net (7.0)

    Thanks

  2. #2
    Registered User
    Join Date
    Oct 2002
    Posts
    72
    well, I've found that I can add this:

    /I "../Common"

    to the Additional command line options in the C/C++ section of the project properties. Is this the best way?

  3. #3
    Registered User
    Join Date
    Apr 2004
    Posts
    29
    -But , if you open view->explore solutions
    -then in the c:\where your project files are\
    put .h an .c files ...
    -then thru explore solutions,click on the include folder with the right mouse and browse and select the include files
    -the same thing for the source folder
    ----so the enviroment knows where the added files are.-
    bye

  4. #4
    Registered User
    Join Date
    Oct 2002
    Posts
    72
    Quote Originally Posted by ABitLazy
    -But , if you open view->explore solutions
    -then in the c:\where your project files are\
    put .h an .c files ...
    -then thru explore solutions,click on the include folder with the right mouse and browse and select the include files
    -the same thing for the source folder
    ----so the enviroment knows where the added files are.-
    bye
    I'm not sure if I understand you. Before I did the /I thing I mentioned above, I added the files to my solution explorer by right-clicking & chosing "Add existing item"
    Then I selected both the .C/.h which went into the Source Files, Header Files section of the solution explorer, just like they should, but when the .C tried to include the .h, it couldn't find it unless I have the /I in the command line.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Reading .dat files from a folder in current directory...
    By porsche911nfs in forum C++ Programming
    Replies: 7
    Last Post: 04-04-2009, 09:52 PM
  2. Help me with function call
    By NeMewSys in forum C++ Programming
    Replies: 16
    Last Post: 05-22-2008, 01:53 PM
  3. MFC include BS
    By VirtualAce in forum Windows Programming
    Replies: 4
    Last Post: 10-31-2005, 12:44 PM
  4. include library header in header files
    By Raison in forum C++ Programming
    Replies: 6
    Last Post: 09-27-2004, 02:50 AM
  5. Another question on classes
    By hpy_gilmore8 in forum C++ Programming
    Replies: 26
    Last Post: 05-24-2003, 09:11 AM