# Problems with GLFW include directory (C program)

**URL:** <https://discourse.glfw.org/t/problems-with-glfw-include-directory-c-program/2289>\
**Category:** support\
**Created:** [January 20, 2023, 2:43am UTC](https://discourse.glfw.org/t/problems-with-glfw-include-directory-c-program/2289 "2023-01-20T02:43:53Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![jimmy](https://avatars.discourse-cdn.com/v4/letter/j/ee59a6/32.png) [@jimmy](https://discourse.glfw.org/u/jimmy)\
**Post date:** [January 20, 2023, 2:43am UTC](https://discourse.glfw.org/t/problems-with-glfw-include-directory-c-program/2289/1 "2023-01-20T02:43:53Z")

</div>

## Two C programs using GLFW 3.3.8 Two C programs with the same headers and linker inputs. d:\code\font\_test.c

Program font\_text.c - when compiled gets error message  
E1696 cannot open source file “GLFW\glfw3.h”

#include \<stdlib.h\>  
#include \<stdio.h\>  
#include \<string.h\>

#define GLFW\_INCLUDE\_GLU  
#include \<GLFW\glfw3.h\>  
Note: #include is underlined in red. (WHY)

Additional Include Directories D:\code\glfw3.3.8\include

Linker inputs (same for both programs)  
D:\Code\glfw-3.3.8\lib-vc2022\glfw3dll.lib;opengl32.lib; glu32.lib; odbc32.lib; odbccp32.lib

* * *

Program glfw\_test.c - compiles, links and runs OK

#include \<stdlib.h\>  
#include \<stdio.h\>  
#include \<string.h\>

#define GLFW\_INCLUDE\_GLU  
#include \<GLFW/glfw3.h\>  
Note: #include is NOT underlined in red.  
Additional Include Directories D:\code\glfw3.3.8\include

Linker inputs  
D:\Code\glfw-3.3.8\lib-vc2022\glfw3dll.lib;opengl32.lib; glu32.lib; odbc32.lib; odbccp32.lib

---

<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:** [January 20, 2023, 4:02am UTC](https://discourse.glfw.org/t/problems-with-glfw-include-directory-c-program/2289/2 "2023-01-20T04:02:27Z")

</div>

I assume this is in Visual Studio? I assume you put the include path wrongly, either some typo or for wrong configuration/platform setting. Please check more carefully. Otherwise there should be no reason to show any errors for same path in different projects.

---

<div class="post-metadata">

**Author:** ![jimmy](https://avatars.discourse-cdn.com/v4/letter/j/ee59a6/32.png) [@jimmy](https://discourse.glfw.org/u/jimmy)\
**Post date:** [January 20, 2023, 4:29am UTC](https://discourse.glfw.org/t/problems-with-glfw-include-directory-c-program/2289/3 "2023-01-20T04:29:53Z")

</div>

Yes, VS 2022. I have triple checked for typos. Found none.

---

<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:** [January 20, 2023, 4:47am UTC](https://discourse.glfw.org/t/problems-with-glfw-include-directory-c-program/2289/4 "2023-01-20T04:47:48Z")

</div>

Are you sure you’re changing properties for same configuration/platform you selected to build?

Like are these things matching?

[![](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/ca845a7ad3305560dc88064e466b2ea9f0760529.png) ](https://learn.microsoft.com/en-us/cpp/build/media/visual-c---property-pages-showing-active-configuration.png?view=msvc-170)

Can you show screenshot of C/C++ → ComandLine window?

---

<div class="post-metadata">

**Author:** ![jimmy](https://avatars.discourse-cdn.com/v4/letter/j/ee59a6/32.png) [@jimmy](https://discourse.glfw.org/u/jimmy)\
**Post date:** [January 23, 2023, 12:38am UTC](https://discourse.glfw.org/t/problems-with-glfw-include-directory-c-program/2289/5 "2023-01-23T00:38:23Z")

</div>

Your own test program has problems.

Using VC 2022 latest version Version 17.4.4 64 bit  
Command line to compiler  
/JMC /permissive- /ifcOutput “x64\Debug" /GS /W3 /Zc:wchar\_t /I"d:\code\glfw3.3.8\include” /ZI /Gm- /Od /sdl /Fd"x64\Debug\vc143.pdb" /Zc:inline /fp:precise /D “\_DEBUG” /D “\_CONSOLE” /D “\_UNICODE” /D “UNICODE” /errorReport:prompt /WX- /Zc:forScope /RTC1 /Gd /MDd /FC /Fa"x64\Debug" /EHsc /nologo /Fo"x64\Debug" /Fp"x64\Debug\gtest.pch" /diagnostics:column

Command line to linker  
/OUT:“D:\Code\oglfontlib\gtest\x64\Debug\gtest.exe” /MANIFEST /NXCOMPAT /PDB:“D:\Code\oglfontlib\gtest\x64\Debug\gtest.pdb” /DYNAMICBASE “D:\Code\glfw-3.3.8\lib-vc2022\glfw3dll.lib” “opengl32.lib” “glu32.lib” “odbc32.lib” “odbccp32.lib” “kernel32.lib” “user32.lib” “gdi32.lib” “winspool.lib” “comdlg32.lib” “advapi32.lib” “shell32.lib” “ole32.lib” “oleaut32.lib” “uuid.lib” /DEBUG /MACHINE:X64 /INCREMENTAL /PGD:“D:\Code\oglfontlib\gtest\x64\Debug\gtest.pgd” /SUBSYSTEM:CONSOLE /MANIFESTUAC:“level=‘asInvoker’ uiAccess=‘false’” /ManifestFile:“x64\Debug\gtest.exe.intermediate.manifest” /LTCGOUT:“x64\Debug\gtest.iobj” /ERRORREPORT:PROMPT /ILK:“x64\Debug\gtest.ilk” /NOLOGO /TLBID:1

Source:  
#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;

```

}

---

<div class="post-metadata">

**Author:** ![jimmy](https://avatars.discourse-cdn.com/v4/letter/j/ee59a6/32.png) [@jimmy](https://discourse.glfw.org/u/jimmy)\
**Post date:** [January 24, 2023, 1:02am UTC](https://discourse.glfw.org/t/problems-with-glfw-include-directory-c-program/2289/6 "2023-01-24T01:02:23Z")

</div>

![image](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/62c7d650a74ce6623deda29edc726f00083e653b.jpeg)

---

<div class="post-metadata">

**Author:** ![jimmy](https://avatars.discourse-cdn.com/v4/letter/j/ee59a6/32.png) [@jimmy](https://discourse.glfw.org/u/jimmy)\
**Post date:** [January 24, 2023, 1:03am UTC](https://discourse.glfw.org/t/problems-with-glfw-include-directory-c-program/2289/7 "2023-01-24T01:03:25Z")

</div>

Create this as an empty project.

---

<div class="post-metadata">

**Author:** ![jimmy](https://avatars.discourse-cdn.com/v4/letter/j/ee59a6/32.png) [@jimmy](https://discourse.glfw.org/u/jimmy)\
**Post date:** [January 24, 2023, 3:00am UTC](https://discourse.glfw.org/t/problems-with-glfw-include-directory-c-program/2289/8 "2023-01-24T03:00:53Z")

</div>

Think I have found issue glfw-3.3.8 vs glfw3.3.8

---

<div class="post-metadata">

**Author:** ![jimmy](https://avatars.discourse-cdn.com/v4/letter/j/ee59a6/32.png) [@jimmy](https://discourse.glfw.org/u/jimmy)\
**Post date:** [January 24, 2023, 3:29am UTC](https://discourse.glfw.org/t/problems-with-glfw-include-directory-c-program/2289/9 "2023-01-24T03:29:29Z")

</div>

![image](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/91a1c185f8965bd006f20e35e492794b49ff7616.jpeg)

---

<div class="post-metadata">

**Author:** ![jimmy](https://avatars.discourse-cdn.com/v4/letter/j/ee59a6/32.png) [@jimmy](https://discourse.glfw.org/u/jimmy)\
**Post date:** [January 24, 2023, 3:30am UTC](https://discourse.glfw.org/t/problems-with-glfw-include-directory-c-program/2289/10 "2023-01-24T03:30:13Z")

</div>

Oops, Still not fixed

---

<div class="post-metadata">

**Author:** ![dougbinks](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/dougbinks/32/39_2.png) [@dougbinks](https://discourse.glfw.org/u/dougbinks)\
**Post date:** [January 25, 2023, 2:21pm UTC](https://discourse.glfw.org/t/problems-with-glfw-include-directory-c-program/2289/11 "2023-01-25T14:21:02Z")

</div>

If you are continuing to have problems with configuring Visual Studio to compile a GLFW program then I suggest you first check out this [simple GLFW CMake starter](https://github.com/juliettef/GLFW-CMake-starter), following the instructions on the readme.

Once you have this up and running you can either use this as a basis for your own program by changing the code in `main.cpp`, or you can look at the project settings to help guide you towards configuring Visual Studio.

---

<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:** [January 26, 2023, 6:48am UTC](https://discourse.glfw.org/t/problems-with-glfw-include-directory-c-program/2289/12 "2023-01-26T06:48:39Z")

</div>

I would assume you still have some kind of typo or files are not where you think they are.  
Please open `D:\code\glfw-3.3.8\include\glfw` folder and show screenshot that it really has `glfw3.h` file inside it.

---

<div class="post-metadata">

**Author:** ![jimmy](https://avatars.discourse-cdn.com/v4/letter/j/ee59a6/32.png) [@jimmy](https://discourse.glfw.org/u/jimmy)\
**Post date:** [January 28, 2023, 5:54am UTC](https://discourse.glfw.org/t/problems-with-glfw-include-directory-c-program/2289/13 "2023-01-28T05:54:42Z")

</div>

I was able to get a VS program GLFW\_TEST testing GLFW and my font library to execute. Program required glfw3.dll to in the same directory as executable (a common problem) However, it would only work if I used lib-vs2022\glfw3dll.lib when compiling and linking.  
what is the difference between glfw3dll.lib, glfw3.lib and glfw3.dll? Are all these 64 bit libraries? If I used the glfw3.lib or glfw3.dll VS said it could find these files even though I use the same path as glfw3dll.lib. Program works great with my font library just like it did with GCC mingw code blocks compiler and linker. Making progress.

---

<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:** [January 28, 2023, 6:09am UTC](https://discourse.glfw.org/t/problems-with-glfw-include-directory-c-program/2289/14 "2023-01-28T06:09:43Z")

</div>

`glfw3.dll` is dynamic library that contains glfw3 library code and anybody can use it to call functions in it.

`glfw3dll.lib` is import file for `glfw3.dll` dynamic library. It means `glfw3dll.lib` contains necessary information for linker to produce code that calls functions into `glfw3.dll` file - executable produced by linking with this .lib file will require glfw3.dll at runtime.

`glfw3.lib` is static library - which means it contains all the glfw3 code and if you pass it to linker, then linker will executable that will not need any glfw dll file at runtime, because all the glfw code will be compiled into exe itself.
