0
\$\begingroup\$

I have set up GLFW and GLAD in Visual Studio 2017 as follows:
I created in C: directory folder GLFW-GLAD, and put in there, "glfw" (Windows pre-compiled binaries, 32-bit Windows binaries) as well "glad". Also in V.S. I created Empty Project "Project-0" and Source file "Main.cpp".
1. In project GLFW-GLAD's "Properties", Configuration: [All Configurations], Platform: [Active(Win32)], Configuration Properties:
1.1. C/C++ > General > "Additional Include Directories" window > "C:\GLFW-GLAD\glfw\include" and "C:\GLFW-GLAD\glad\include".
1.2. Linker > General > "Additional Library Directories" window > "C:\GLFW-GLAD\glfw\lib-vc2015"
1.3. Linker > Input > "Additional Dependencies" window > "opengl32.lib; glfw3.lib; glfw3dll.lib".
1.4. Linker > System > Subsystem > Console (/SUBSYSTEM:CONSOLE)
2. In project folder "Project-0" I have pasted files: "glad.c" and "glfw3.dll".
I copied program from https://www.glfw.org/docs/latest/quick.html and pasted in Main.cpp code area. I attempted run it but failed. Output is
"fatal error C1083: Cannot open include file: 'linmath.h': No such file or directory"
Please help.

\$\endgroup\$
  • 1
    \$\begingroup\$ Hi, and welcome to gamedev stack exchange! This question is not really on-topic with our site, but you might get more help on sites like Stack overflow :) \$\endgroup\$ – user115399 Oct 31 '18 at 14:18
  • 2
    \$\begingroup\$ @GabrieleVierti I think it makes it easier for new users if you mention why this question is off-topic. I would consider it on-topic if the problem had to do with GLFW/OpenGL, but this issue seems a plain programming issue. I think OP could benefit from following some tutorials online of how compilation of a program works on Visual Studio. \$\endgroup\$ – TomTsagk Oct 31 '18 at 14:28
  • \$\begingroup\$ You should take a look at our help center for more information of what can be asked on gamedev :). To solve your problem, you should take a look at how to setup libraries in visual studio. Here is a good tutorial by Yan \$\endgroup\$ – user115399 Oct 31 '18 at 14:56
3
\$\begingroup\$

"fatal error C1083: Cannot open include file: 'linmath.h': No such file or directory"

This error means what it says: the specified file (linmath.h) was not found. Step number one is diagnosing this error is to find the file yourself on your filesystem and prove it actually exists. I suspect it doesn't, in your case, due to something I note below.

But if you can find the file, the next step is to compare the include search paths for the source file being compiled and make sure that one of them would result in the compiler being able to find the file by the name you specified in the #include directive.

linmath.h is inside the deps directory in the source tree for GLFW. If you examine the directory structure of a package Windows distribution of GLFW, you won't find linmath.h at all.

If you want to use that source code example unmodified, you have to download a copy of the linmath.h header and put it either next to your Main.cpp source file or inside one of the include paths you configured.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ @ Josh, please accept my many thanks for your answer. I created header file "linmath.h" and output was "1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library 1>Main.obj : error LNK2019: unresolved external symbol _gladLoadGLLoader referenced in function _main 1>Main.obj : error LNK2001: unresolved external symbol _glad_glClear , and other 18 errors LNK2001". Then I copied "linmath.h" and pasted in project folder, but output was the same. Regards. \$\endgroup\$ – George Theodosiou Nov 2 '18 at 16:22
  • \$\begingroup\$ This is a different error and thus probably should be a different post. The short version is that you are now failing to tell the linker to link in the library that contains the function "gladLoadGLLoader" (and others). \$\endgroup\$ – user1430 Nov 2 '18 at 17:46
  • \$\begingroup\$ @ Josh, please accept my thanks for your comments and my sorrow for the delay in my response. My second error is in step 2. File "glad.c" is not .dll, so it should not be pasted in project folder but be added in project through Visual Studio > Solution explorer > Source files > Existing item. Regards. \$\endgroup\$ – George Theodosiou Nov 19 '18 at 9:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.