How to include header files in Visual Studio 2008?

后端 未结 4 742
感动是毒
感动是毒 2021-02-14 18:03

I am currently trying to compile a simple program that includes two header files. I see them in the Solution Explorer, where I included them through \"include existing files\".

4条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-14 18:39

    If you write in your code something like #include "FileWrite.h" you need to make sure compiler can find that file. There are three options:

    • FileWrite.h should either be in the same directory as your source code file (.cpp) or
    • Path to that header file should should be listed in project's Properties (in C/C++ -> General -> Additional Include Directories) or
    • Path could be set in your VisualStudio - add it to Include Files in Tools->Options->Projects and Solutions->VC++ Directories

    Which of these options shell be used depends on whether that header originates from this project (1st option) or some other project (any of other two options).

提交回复
热议问题