locked
How to set "include"-paths for new projects in a solution? RRS feed

  • Question

  • Hello there!

    I am using an open source solution and want to create a new project in it.

    There are several example projects in the solution which somehow search through the include path of the "master" project.

     

    My newly created project doesn't look in that paths though, so of course I get the error:

     

    fatal error C1083: Cannot open include file: 'eval.h': No such file or directory

     

    I tried setting "Project dependencies" to the master project and it doesn't solve the problem.

    In the new project's properties I have also tried adding the include folder as a "Reference Serch Path" as well as adding the master project as a "Reference". Both tries didn't help, the error is still there.

     

    ProcMon proofed me that my newly created project doesn't search in the master include-path.

     

    How to set this option?

    TIA,

    Equax

     

    I use MSVC++ 2008.
    • Edited by Equax Tuesday, November 29, 2011 4:57 PM
    Tuesday, November 29, 2011 4:48 PM

Answers

  • Hi Equax,
     
    I suppose you have added a new project to an existing solution.
     
    In a solution, the first project created is the startup project by default. A project in a solution usually searches header files (defined in the project) in the project's folder (named as the project's name), not in the solution’s folder. If you want the project to use other headers not defined in it, you should try to add additional include directories and add codes like "#include *.h" when using it. We can use project dependency to build certain project first and to generate codes used by other projects. I am afraid it makes no difference on the search order of header files.
     
    If eval.h is not a header in your newly created project but you used it, you should add additional include directories for the project. Open the newly created project's Property pages->Configuration Properties->C/C++->General->Additional Include Directories and add the path of eval.h into the textbox on the right side.
     
    If eval.h is a header defined in the newly created project, we should place it under the project's folder and I recommend that we not change its location after being created.
     
    Best regards,
    Helen

     


    Helen Zhao [MSFT]
    MSDN Community Support | Feedback to us
    • Proposed as answer by dezire Thursday, December 1, 2011 3:21 PM
    • Marked as answer by Helen Zhao Wednesday, December 7, 2011 1:22 AM
    Thursday, December 1, 2011 7:32 AM

All replies

  • Hi Equax,
     
    I suppose you have added a new project to an existing solution.
     
    In a solution, the first project created is the startup project by default. A project in a solution usually searches header files (defined in the project) in the project's folder (named as the project's name), not in the solution’s folder. If you want the project to use other headers not defined in it, you should try to add additional include directories and add codes like "#include *.h" when using it. We can use project dependency to build certain project first and to generate codes used by other projects. I am afraid it makes no difference on the search order of header files.
     
    If eval.h is not a header in your newly created project but you used it, you should add additional include directories for the project. Open the newly created project's Property pages->Configuration Properties->C/C++->General->Additional Include Directories and add the path of eval.h into the textbox on the right side.
     
    If eval.h is a header defined in the newly created project, we should place it under the project's folder and I recommend that we not change its location after being created.
     
    Best regards,
    Helen

     


    Helen Zhao [MSFT]
    MSDN Community Support | Feedback to us
    • Proposed as answer by dezire Thursday, December 1, 2011 3:21 PM
    • Marked as answer by Helen Zhao Wednesday, December 7, 2011 1:22 AM
    Thursday, December 1, 2011 7:32 AM
  • Hi Equax,
     
    I'd like to mark my reply as answer. If you have any questions, you can post back and unmark it. We'll continue working with you on this issue.
     
    Thanks for your understanding.
    Best regards,
    Helen Zhao [MSFT]
    MSDN Community Support | Feedback to us

    • Edited by Helen Zhao Wednesday, December 7, 2011 7:47 AM
    Wednesday, December 7, 2011 1:22 AM