简体   繁体   中英

OpenGL libraries on visual studio cant link libraries

I have been trying to set up OpenGL to run on my laptop on windows 11 in Visual Studio Code. I want to be able to code openGL using the glfw library although I believe I made need others?. at the moment the only libraries I can include are:

#include <GL/GL.h>
#include <GL/GLU.h>

both of these libraries do not work with example of code I have tried. Many videos have done it by downloading glfw and glew libraries and linking them in visual studio in properties but hen in example codes they include the libraries using:

#include <glfw/glfw3.h>

or

#include <GL/glfw3.h>

When any of these setups are run on either vs or vs code i get this error message:

a.cpp:3:24: fatal error: glfw/glfe3.h: No such file or directory

I also get an error in the compilation where it cannot find the executable although I believe this is because it never finishes compilation.

Managed to figure it out with the help of my computer science teacher. My problem was that my sdk was not up to date updating this made it work for visual studio code. If the sdk is not up to date it will not include the libraries that are needed this didn't add glew however but instead used glad which I have found in tutorials also works.

The link to the updater is here: https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/

for visual studio I made sure to include the sdk library when reinstalling/ installing it with the C++ extension.

edit: for vs this only works when you are running your code or project in WIN32 x64 and x86 do not work I am not sure why.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM