-2

I am trying to develop a game using GLFW and C++, but to do this I need to add add a new "Include Directory", how would I go about this?

So far, I have tried to add it to "Configuration Properties/VC++ Directories/Include Directories" and to "C\C++/General/Additional Include Directories" and both have been unsuccessful.

In the Project File, I have a libraries folder, and inside it are a folder called "GLFW", and a file called "glfw3.lib". Inside the "GLFW" folder, there are two files called "glfw3.h" and "glfw3native.h". I am unsure what else to post in this section so apologies on that part.

I expect to be able to do the code "#include " but it comes up with an error saying that it cannot open the source file.

I appreciate any help you can give!

AncientScarab
  • 11
  • 1
  • 1
  • Visual Studio has build targets for Debug and Release builds, and x86 and x64 builds: which are you using, and can you confirm that you added this directory to the "Include Directories" property specifically for the build you're trying to compile? – Xirema Aug 07 '19 at 17:02
  • @Xirema I am using the build target "Release", and the Platform is "Active(Win32)". I am unsure what you mean by the last section – AncientScarab Aug 07 '19 at 17:04
  • @Xirema after reading your comment again, I have figured out that on the main screen for visual studio i was running debug and not release. Thank you so much for the help! – AncientScarab Aug 07 '19 at 17:12

1 Answers1

2

You need to make sure that you add the configuration properties to the correct build target and platform for your code.

If you only add these properties to the "Debug" Build Target and then try to compile in "Release" (or vise-versa) then the compiler won't be able to find your libraries.

You should manually change these properties for each Build Target you intend to build for, and for each Platform you intend to build for. Often (especially for newer programmers), it's best if you just stick with one of each (I recommend Debug for build target and x64 for Platform), so that you don't have to perform this step repeatedly.

Alternatively, if there's no difference in your libraries between debug and release (which commonly happens if you don't build the libraries yourself and just use whatever the vendor provided) you can choose, when setting your configuration, to affect ALL build targets; although this probably won't work for ALL platforms (since Win32 code can't be linked with x64 code). So you'll still need to specifically choose the correct platform for your code.

Xirema
  • 19,889
  • 4
  • 32
  • 68