# Problems installing GLFW - Visual Studio 2015

**URL:** <https://discourse.glfw.org/t/problems-installing-glfw-visual-studio-2015/1020>\
**Category:** support\
**Created:** [October 16, 2017, 11:49pm UTC](https://discourse.glfw.org/t/problems-installing-glfw-visual-studio-2015/1020 "2017-10-16T23:49:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kovicic](https://avatars.discourse-cdn.com/v4/letter/k/edb3f5/32.png) [@kovicic](https://discourse.glfw.org/u/kovicic)\
**Post date:** [October 16, 2017, 11:49pm UTC](https://discourse.glfw.org/t/problems-installing-glfw-visual-studio-2015/1020/1 "2017-10-16T23:49:15Z")

</div>

Hi everyone!, I have spent hours trying to compile the following example.  
Steps I followed with both flavours, 32 and 64 bits.

1- Downloaded pre compiled binaries, unzipped them in a GLFW folder.  
2- I set the include directories pointin to the carpet that contains the .h  
3- I set the library directory pointing to where the .dll are.  
4 - linker - inputs: added the following libs: opengl32.lib, glfw3.lib, glfw3dll.lib.  
5- I copy the library file to where my main.cpp file is (project folder) - glfw3.dll

```
#define GLFW_BUILD // I commented this line, it doesn´t change anything

#include <GLFW/glfw3.h>

int main(void)
{
	GLFWwindow* window;

	/* Initialize the library */
	if (!glfwInit())
		return -1;

	/* Create a windowed mode window and its OpenGL context */
	window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
	if (!window)
	{
		glfwTerminate();
		return -1;
	}

	/* Make the window's context current */
	glfwMakeContextCurrent(window);

	/* Loop until the user closes the window */
	while (!glfwWindowShouldClose(window))
	{
		/* Render here */
		//glClear(GL_COLOR_BUFFER_BIT);

		///* Swap front and back buffers */
		//glfwSwapBuffers(window);

		///* Poll for and process events */
		//glfwPollEvents();
	}

	glfwTerminate();
	return 0;
}

```

However I have these kind of messages:

- cannot open source file “GLFW/glfw3.h” GLFW32b c:\Users\kovicic\Documents\Visual Studio 2015\Projects\GLFW32b\GLFW32b\main.cpp
- identifier “GLFWwindow” is undefined GLFW32b c:\Users\kovicic\Documents\Visual Studio 2015\Projects\GLFW32b\GLFW32b\main.cpp 8
- the same as the line above for every GLFW function.

I´ve been followed any tutorial I´ve seen. Nothing seems to help.  
I compiled the source (CMake) and generate the libraries, no change though.

SO: Windows 7 Ultimate 64 bits

Any ideas? I appreciate too much any hint. Is frustrating spending more time trying to set up a library rather than trying to learning.  
Thanks in advance.  
Best!

---

<div class="post-metadata">

**Author:** ![mmozeiko](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/mmozeiko/32/29_2.png) [@mmozeiko](https://discourse.glfw.org/u/mmozeiko)\
**Post date:** [October 17, 2017, 12:42am UTC](https://discourse.glfw.org/t/problems-installing-glfw-visual-studio-2015/1020/2 "2017-10-17T00:42:31Z")

</div>

This error means that you have not set include path to correct folder.  
For example, If your glfw3.h file is in `C:\MyFolder\GLFW\glfw3.h` location, that means your include path must be set to `C:\MyFolder`. It can be also a relative path from folder where is your project file (vcxproj).

You don’t need to define `GLFW_BUILD`. It is used only internally in glfw when building it from source.  
And you need only one of these libraries - glfw3.lib, glfw3dll.lib. Not both of them. One is for static linking, other is for dynamic.

---

<div class="post-metadata">

**Author:** ![kovicic](https://avatars.discourse-cdn.com/v4/letter/k/edb3f5/32.png) [@kovicic](https://discourse.glfw.org/u/kovicic)\
**Post date:** [October 17, 2017, 2:09am UTC](https://discourse.glfw.org/t/problems-installing-glfw-visual-studio-2015/1020/3 "2017-10-17T02:09:32Z")

</div>

Thanks for your reply @mmozeiko. Actually I set the directory as I stated in my previous post, I checked and it points to the right one.  
For instance, in the example you mentioned, I “set” the include directory to:  
\_C:\MyFolder\GLFW\_

The closer I´ve been is with the x64 version, it compiles, but it throws the following errors:

```
Unloaded 'C:\Windows\System32\xinput1_3.dll'
'GLFWTest.exe' (Win32): Unloaded 'C:\Windows\System32\dinput8.dll'
'GLFWTest.exe' (Win32): Unloaded 'C:\Windows\System32\hid.dll'
'GLFWTest.exe' (Win32): Unloaded 'C:\Windows\System32\winmm.dll'

```

However, I have these files twice under Windows, for the 32 and 64 version.  
(Actually I commented out GLFW\_BUILD, nothing changed).

---

<div class="post-metadata">

**Author:** ![kovicic](https://avatars.discourse-cdn.com/v4/letter/k/edb3f5/32.png) [@kovicic](https://discourse.glfw.org/u/kovicic)\
**Post date:** [October 17, 2017, 2:14am UTC](https://discourse.glfw.org/t/problems-installing-glfw-visual-studio-2015/1020/4 "2017-10-17T02:14:49Z")

</div>

For instance, by doing the same procedure I can run freeglut examples. So, I don´t tend to think is something related with the include/library directories. I am totally clueless actually.

---

<div class="post-metadata">

**Author:** ![mmozeiko](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/mmozeiko/32/29_2.png) [@mmozeiko](https://discourse.glfw.org/u/mmozeiko)\
**Post date:** [October 17, 2017, 5:31am UTC](https://discourse.glfw.org/t/problems-installing-glfw-visual-studio-2015/1020/5 "2017-10-17T05:31:28Z")

</div>

Are you sure you have glfw3.h file in `C:\MyFolder\GLFW\GLFW\glfw3.h` location?  
If it is in `C:\MyFolder\GLFW\glfw3.h` location you need to use `C:\MyFolder` and NOT `C:\MyFolder\GLFW` as include path. If you include path is X, and you say #include \<a\b.h\> then compiler will look for this file in “X\a\b.h” location.

Unloaded messages in output window are normal. On 64-bit Windows 64-bit dll files are inside C:\Windows\System32 folder.

---

<div class="post-metadata">

**Author:** ![kovicic](https://avatars.discourse-cdn.com/v4/letter/k/edb3f5/32.png) [@kovicic](https://discourse.glfw.org/u/kovicic)\
**Post date:** [October 17, 2017, 5:01pm UTC](https://discourse.glfw.org/t/problems-installing-glfw-visual-studio-2015/1020/6 "2017-10-17T17:01:21Z")

</div>

@mmozeiko Thanks for your response. My bad I didn´t clarify things correctly.  
If I add as the include library the C:\MyFolder\GLFW folder, then in my code I write without the folder prefix name:  
`#include <glfw3.h>`

In case I put C:\MyFolder in the include library, my code is in this way:  
`#include <GLFW/glfw3.h>`

I am sure I am pointing to the correct place since glfw3,h is under the C:\MyFolder\GLFW directory.  
I tryed both ways, it doesn´t compile well for 32 bits, claiming it couldn´t find the .h files.

I am almost sure my error isn´t about .h locations, but I don´t know what else to try. I even updated visual c ++  
common tools.

Step 2: I tryed the 64 bit precompiled libraries.  
As for the messages about complaining that it couldn´t load some 32 bits files, amazes me, because all these files are there. Why they cannot be loaded?  
(I come from linux, I didn´t know the 64 bit dll files were under System32…confusing to say the least).  
I seemed it´s the cause for not to make the example work.
