Reputation: 1711
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 but that is of no help. The file is iGraphics.h
and it is shown in the header files list but does not compile. What should be the correct approach?
Upvotes: 16
Views: 65067
Reputation: 312
The easiest way to do this is:
In VS2012, just using '"' instead of '<>' around the header file in include also works.
Upvotes: 2
Reputation: 2340
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.
Upvotes: 1
Reputation: 258648
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.
Upvotes: 20