- 1
- 51 659
rosxnb
Nepal
เข้าร่วมเมื่อ 4 ส.ค. 2021
OpenGL setup: GLFW and GLAD in Visual Studio Code on macOS
Contents of the video:
00:00 Intro
01:00 GLFW download and project setup
03:03 VS Code default build task configuration
06:46 Glad download
Homebrew : brew.sh
GLAD : glad.dav1d.de
Sample code 1 : www.glfw.org/documentation.html
Sample code 2 : learnopengl.com/code_viewer_gh.php?code=src/1.getting_started/2.1.hello_triangle/hello_triangle.cpp
--------------------------------------------------
--------------------tasks.json--------------------
{
"version": "2.0.0",
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: clang++ build active file",
"command": "/usr/bin/clang++",
"args": [
"-std=c++17",
"-fdiagnostics-color=always",
"-Wall",
"-g",
"-I${workspaceFolder}/dependencies/include",
"-L${workspaceFolder}/dependencies/library",
"${workspaceFolder}/dependencies/library/libglfw.3.3.dylib",
"${workspaceFolder}/*.cpp",
"${workspaceFolder}/glad.c",
"-o",
"${workspaceFolder}/app",
"-framework",
"OpenGL",
"-framework",
"Cocoa",
"-framework",
"IOKit",
"-framework",
"CoreVideo",
"-framework",
"CoreFoundation",
"-Wno-deprecated"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": ["$gcc"],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "compiler: /usr/bin/clang++"
}
]
}
00:00 Intro
01:00 GLFW download and project setup
03:03 VS Code default build task configuration
06:46 Glad download
Homebrew : brew.sh
GLAD : glad.dav1d.de
Sample code 1 : www.glfw.org/documentation.html
Sample code 2 : learnopengl.com/code_viewer_gh.php?code=src/1.getting_started/2.1.hello_triangle/hello_triangle.cpp
--------------------------------------------------
--------------------tasks.json--------------------
{
"version": "2.0.0",
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: clang++ build active file",
"command": "/usr/bin/clang++",
"args": [
"-std=c++17",
"-fdiagnostics-color=always",
"-Wall",
"-g",
"-I${workspaceFolder}/dependencies/include",
"-L${workspaceFolder}/dependencies/library",
"${workspaceFolder}/dependencies/library/libglfw.3.3.dylib",
"${workspaceFolder}/*.cpp",
"${workspaceFolder}/glad.c",
"-o",
"${workspaceFolder}/app",
"-framework",
"OpenGL",
"-framework",
"Cocoa",
"-framework",
"IOKit",
"-framework",
"CoreVideo",
"-framework",
"CoreFoundation",
"-Wno-deprecated"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": ["$gcc"],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "compiler: /usr/bin/clang++"
}
]
}
มุมมอง: 51 668
You helped me a lot, thank you so much!
Thank you so much! It was a headache trying to get this working.
Thank you so much
Thank you a Million times <3
I don't know how to thank you enough, you literally saved me, you are the best 🫡🫡🫡🫡🫡🫡🫡🫡
😭😭😭😭 you are goated thank u so much, subscribed
Actual GOAT, ty ty ty <3
Thanks man, this really helped, was stuck for 2 hours, trying to figure it out for my MBP M2 Pro
I have a problem building the app, It says "building for macOS-x86_64 but attempting to link with file built for macOS-arm64" and I see the solution is to add the "-DCMAKE_APPLE_SILICON_PROCESSOR=arm64" I add after the version of C++ on the build file, but It doesn't work
Thanks so much, I finally understand what's going on with the JSON files 😂
i couldn't find the glfw file in my mac
{ "version": "2.0.0", "tasks": [ { "type": "cppbuild", "label": "C/C++: clang++ build active file", "command": "/usr/bin/clang++", "args": [ "-std=c++17", // C++ Version "-fcolor-diagnostics", "-fansi-escape-codes", "-Wall", // Enable all warnings "-g", "-I${workspaceFolder}/dependencies/include", // Specifying path to include files "-L${workspaceFolder}/dependencies/library", // Specify path for our library "${workspaceFolder}/dependencies/library/libglfw.3.4.dylib", // "${workspaceFolder}/*.cpp", // Specify which file to Execute...( Now all the CPP files .) "${workspaceFolder}/glad.c", "-o", "${workspaceFolder}/app", // "${fileDirname}/${fileBasenameNoExtension}" ---> Name of application -- in Terminal ./app "-framework", // Additional frame work "OpenGL", "-framework", "Cocoa", "-framework", "IOKit", "-framework", "CoreVideo", "-framework", "CoreFoundation", "-Wno-deprecated" // Disable dipreciation warnings ], "options": { "cwd": "${fileDirname}" }, "problemMatcher": ["$gcc"], "group": { "kind": "build", "isDefault": true }, "detail": "compiler: /usr/bin/clang++" } ] }
Thanks a lot
fatal error: 'glad/glad.h' file not found #include <glad/glad.h> ^~~~~~~~~~~~~ 1 error generated. i go this error please help
{ "version": "2.0.0", "tasks": [ { "type": "cppbuild", "label": "C/C++: clang build active file", "command": "/usr/bin/clang", "args": [ "-std=c++17", "-fcolor-diagnostics", "-fansi-escape-codes", "-Wall", "-g", "-I/opt/homebrew/opt/glfw/include", // Updated include path "-L/opt/homebrew/opt/glfw/lib", // Updated library path "-lglfw", // Link GLFW library "-lc++", // Link with the C++ standard library "${workspaceFolder}/*.cpp", // Source files "-o", "${workspaceFolder}/app", // Output executable "-framework", "OpenGL", "-framework", "Cocoa", "-framework", "IOKit", "-framework", "CoreVideo", "-framework", "CoreFoundation", "-Wno-deprecated" ], "options": { "cwd": "${fileDirname}" }, "problemMatcher": [ "$gcc" ], "group": { "kind": "build", "isDefault": true }, "detail": "compiler: /usr/bin/clang" } ] } use this it will work
thanks a lot. you are doing god's work. exactly what I needed.
I have done everything as you said, and it built but did't want to run app. I found out that i needed to add one more line in the task.json inside args "-Wl,-rpath,@executable_path/lib" and now it works perfectly. Thanks very much.
Helped a lot thanks
thank you very much!
Does GLEW need to be installed as well?
hi can you also explain how to add GLUT too?
I got an error: clang: error: no such file or directory: '/Users/.../Desktop/youtube/*.cpp'
replace the apt arg with this: "${workspaceFolder}/${fileBasenameNoExtension}.cpp" and you are good to go
build is taking forever, anyone have any ideas?
thanks for the video. you fix in a 4 min what I was stuck in for the past 3 to 5 hours, keep the grease work
nice number of subs, my guy
Best one! Really help me figure out how to build OpenGL with vscode
After repeating what you did, it gives me "clang: error: linker command failed with exit code 1 (use -v to see invocation)". I would appreciate if someone helps me. P.S I am using glfw 3.3.9
Worked perfectly in mac M1, thank you!
can u instruct me include glut library
fuck this video it didnt work
You have no idea how much this tutorial helped me. I was struggling to find a good tutorial for this EXACT thing and you did it perfectly and clearly.
Thank you so much bro
Simple and straight to the point, thanks!
why i do not have the c/c++ compiler?
Buy a PC, Macs are garbage!
Amazing thanks!
i need help. my error is: error: invalid argument '-std=c++17' not allowed with 'C'. how do i right now
clang: error: no such file or directory: '/Users/siddhantmishra/Desktop/ OpenGl*.cpp' how to fix this error
I had followed all the steps.. but there showed me this error......."'GLFW/glfw3.h' file not found". this file is on the right place, but probably the compiler can't detect it.. what would I do to solve this..??
have you figured out how to solve this error? I have the same
@@Aaans-bd8ep Yes, I did.
how? lol @@ankansaha3260
{ "version": "2.0.0", "tasks": [ { "type": "cppbuild", "label": "C/C++: clang build active file", "command": "/usr/bin/clang", "args": [ "-std=c++17", "-fcolor-diagnostics", "-fansi-escape-codes", "-Wall", "-g", "-I/opt/homebrew/opt/glfw/include", // Updated include path "-L/opt/homebrew/opt/glfw/lib", // Updated library path "-lglfw", // Link GLFW library "-lc++", // Link with the C++ standard library "${workspaceFolder}/*.cpp", // Source files "-o", "${workspaceFolder}/app", // Output executable "-framework", "OpenGL", "-framework", "Cocoa", "-framework", "IOKit", "-framework", "CoreVideo", "-framework", "CoreFoundation", "-Wno-deprecated" ], "options": { "cwd": "${fileDirname}" }, "problemMatcher": [ "$gcc" ], "group": { "kind": "build", "isDefault": true }, "detail": "compiler: /usr/bin/clang" } ] } use this it will work
@@ankansaha3260 how
dude speak louder, damn.
Thanks so much for this!!
Hi I am getting this error dyld[74341]: Library not loaded: @rpath/libglfw.3.dylib after running ./app in the terminal. Can you please help with this
did you solve the issue? am getting the same one
same
Hello. Thanks for this guide, I'm about to start a course that needs OpenGL and I only have a mac laptop so this is great. While trying to run Sample code 1 I get this error: Undefined symbols for architecture x86_64: "_main", referenced from: implicit entry/start for main executable ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) Could you please help me.
have u solved it? i got the same
This is what I have been looking for ages, THANK!!
Great simple and easy tutorial. Thank you! You can also change the file type to be glad.cpp as well to avoid adding the extra path to the args list
Thank you so much, I was looking for a tutorial for like hours until I finally saw your video, and it is working, thanks once again!
Большое спасибо, добрый человек
I choose the same default build task however my args structure is different, is this normal and do I need to change it?
Hi I am getting warning saying ld: warning: dylib was built for newer macOS version (13.0) then being linked (12.3). Do you have any suggestions? I am using the most up to date version of glfw and my Mac is 13?
Works on M1 macbook! Thanks!
I wanna say thank you! I would gone crazy trying to set up all without your video...thanks for sharing!