visual studio 2012 adding new header file

前端 未结 3 1135
猫巷女王i
猫巷女王i 2021-02-07 09:10

In Visual Studio 2012 (C++ environment), for a Win32 console application, I need to include a new header file to my project. I tried copying the files in the project\'s location

相关标签:
3条回答
  • 2021-02-07 10:07

    You should add the path to that header to the additional include directories under C/C++ in your project settings. Afterwards, just #include "iGraphics.h" where you need it.

    Don't just move header files around, and don't add existing headers to your project for no good reason. This way, you can easily change versions by just specifying a different folder.

    0 讨论(0)
  • 2021-02-07 10:15

    Put the file in the right place in the file system (like you did). Then right-click your project in the solution explorer and use Add > Existing Item to add it to your project.

    If you don't want to move your file (which you probably should not), see Luchian's answer on how to add the include directory to the include folders.

    0 讨论(0)
  • 2021-02-07 10:16

    The easiest way to do this is:

    1. Right click on the header file (to be included) in the Solution explorer.
    2. General->"Excluded from the build"
    3. Select "No" from the drop down list
    4. Click "OK".

    In VS2012, just using '"' instead of '<>' around the header file in include also works.

    0 讨论(0)
提交回复
热议问题