C++ OpenGL setup for VSCode in 2min

preview_player
Показать описание
GLFW/GLAD setup for VSCode C++ OpenGL development. Done on Windows with the MingW g++ compiler.

Рекомендации по теме
Комментарии
Автор

ERRATA:
- In the video at 1:35, I build using the custom build command that tasks.json is for, using Ctrl+Shift+B on Windows (or generally Terminal > Run build task).
- If you run into "glad/glad.h: No such file or directory", you may try to include directly the whole path (from where you run the build command, so include/glad/glad.h in my case (as cwd is ${WorkspaceFolder} in tasks.json, and my workspace folder (root dir of the opened VSCode) is the dir above include)), instead of just glad/glad.h.

codedeus
Автор

This was a massive help, I was finally able to get OpenGL to work with VS Code thanks to you. Thank you so much!!!

neilshahcosmos
Автор

glad to see I'm not the only one struggling here!

King-sdvg
Автор

thank you thank you thank you. Setting this up has been kicking my ass for a while. thanks for tutorial

kidando
Автор

Thank you so much. You saved me potential hours of scrolling through Google XD

sirhoog
Автор

thank you dude, I've been struggling to set this up and finally got this working because of you

monkqp
Автор

man how does anyone have the patience to muck around with these libraries

buriedbones-nhxr
Автор

As a recommendation remember to edit the tasks.json file line 7 with your path to g++.exe compiler file :)

uuo
Автор

Just doesn't work for me, I can't have my file in my workspace directly, when I open a folder in vscode it's all in the folder I opened, not at the root of the folder, and it just doesn't work.

theyummydogo
Автор

Thank you. Very helpful and concise guide.

humptyd.
Автор

You just saved my life xD
Straight and accurate

erikdio
Автор

Thanks for the video! It worked for me :D.
I have a question, if I want to add more C++ files, do I have to add it in the "args" of the tasks.json? First time editing tasks.json and I don't understand it very well.

CrisHeredia
Автор

I've followed these steps, but I get a bunch of errors regarding glfw functions. For example one is "main.obj : error LNK2019: unresolved external symbol _glfwInit referenced in function _main". I think the problem might be caused by the compiler ignoring several arguments in the tasks.json file, but I don't know how to fix it. These are the arguments being ignored:
cl : Command line warning D9035 : option 'o' has been deprecated and will be removed in a future release
cl : Command line warning D9002 : ignoring unknown option '-g'
cl : Command line warning D9002 : ignoring unknown option '-libglfw3dll'

BrandonW-tx
Автор

it doesn't work for me. glad.h No such file or directory. The folder hierarchy is correct, I copied the json from you. I started it with this command: g++ -o main src\main.cpp.

orototo
Автор

I did what you said, but it says undefined reference for all of the lines that use something from the GLFW library

SupremeCakeVR
Автор

Hello codedeus, great video.
I have a question, is it possible using GLUT instead of GLFW/GLAD?

david-
Автор

Hi, I have an issue with running the provided code. The build is always successful, but when I try running cutable.exe, it prints "Segmentation fault". An empty main does not do this. Can you help?

matuskrivka
Автор

Hi, I've followed your steps and am using the MinGW-w64 compiler but am receiving many statements of "undefined reference to (glfwFunction)" in my terminal. Do you have any recommendations for how to take on this issue?

thaisartell
Автор

hello dude, I followed the tutorial but i'm still getting undefined reference error to the glfw functions :(
got any idea why???

alanmiraanime
Автор

Hey im stuck on the rasks.json file

Should i change anything from the code you provided in your GITHUB code?
In the line 7 and 29 you declared path to g++ my path might be somewhere else should i changed and if yes please guide me thanks

saulthetaxidriver