rosxnb
rosxnb
  • 1
  • 51 659
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++"
}
]
}
มุมมอง: 51 668

วีดีโอ

ความคิดเห็น

  • @AdrianoCalzadaJr
    @AdrianoCalzadaJr 7 วันที่ผ่านมา

    You helped me a lot, thank you so much!

  • @safacetinkaya
    @safacetinkaya 11 วันที่ผ่านมา

    Thank you so much! It was a headache trying to get this working.

  • @MadelynHoffman-w6x
    @MadelynHoffman-w6x 13 วันที่ผ่านมา

    Thank you so much

  • @phantuananh2163
    @phantuananh2163 17 วันที่ผ่านมา

    Thank you a Million times <3

  • @AlaaOmar-l3n
    @AlaaOmar-l3n หลายเดือนก่อน

    I don't know how to thank you enough, you literally saved me, you are the best 🫡🫡🫡🫡🫡🫡🫡🫡

  • @sebastiandulongsalazar3280
    @sebastiandulongsalazar3280 หลายเดือนก่อน

    😭😭😭😭 you are goated thank u so much, subscribed

  • @WyattJebef-r9t
    @WyattJebef-r9t หลายเดือนก่อน

    Actual GOAT, ty ty ty <3

  • @namanagrawal7703
    @namanagrawal7703 2 หลายเดือนก่อน

    Thanks man, this really helped, was stuck for 2 hours, trying to figure it out for my MBP M2 Pro

  • @AndreaDiaz-zy3jd
    @AndreaDiaz-zy3jd 2 หลายเดือนก่อน

    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

  • @sanjaygupta231
    @sanjaygupta231 3 หลายเดือนก่อน

    Thanks so much, I finally understand what's going on with the JSON files 😂

  • @mira2642
    @mira2642 3 หลายเดือนก่อน

    i couldn't find the glfw file in my mac

  • @Basseloob
    @Basseloob 7 หลายเดือนก่อน

    { "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++" } ] }

  • @hadriencarrozgribot8590
    @hadriencarrozgribot8590 8 หลายเดือนก่อน

    Thanks a lot

  • @gurinderkaur6817
    @gurinderkaur6817 10 หลายเดือนก่อน

    fatal error: 'glad/glad.h' file not found #include <glad/glad.h> ^~~~~~~~~~~~~ 1 error generated. i go this error please help

    • @raghavav9097
      @raghavav9097 5 หลายเดือนก่อน

      { "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

  • @viggenzz
    @viggenzz 10 หลายเดือนก่อน

    thanks a lot. you are doing god's work. exactly what I needed.

  • @dawidklyta2515
    @dawidklyta2515 10 หลายเดือนก่อน

    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.

  • @DevelopedEgg
    @DevelopedEgg 11 หลายเดือนก่อน

    Helped a lot thanks

  • @GWebcob
    @GWebcob 11 หลายเดือนก่อน

    thank you very much!

  • @purassicjark
    @purassicjark ปีที่แล้ว

    Does GLEW need to be installed as well?

  • @chhavi019
    @chhavi019 ปีที่แล้ว

    hi can you also explain how to add GLUT too?

  • @_nakhoo_
    @_nakhoo_ ปีที่แล้ว

    I got an error: clang: error: no such file or directory: '/Users/.../Desktop/youtube/*.cpp'

    • @ayushsah8077
      @ayushsah8077 3 หลายเดือนก่อน

      replace the apt arg with this: "${workspaceFolder}/${fileBasenameNoExtension}.cpp" and you are good to go

  • @ryanliu8665
    @ryanliu8665 ปีที่แล้ว

    build is taking forever, anyone have any ideas?

  • @aninosspro
    @aninosspro ปีที่แล้ว

    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

  • @brunocastro7858
    @brunocastro7858 ปีที่แล้ว

    nice number of subs, my guy

  • @aaaakko139
    @aaaakko139 ปีที่แล้ว

    Best one! Really help me figure out how to build OpenGL with vscode

  • @Itsme-yq7cj
    @Itsme-yq7cj ปีที่แล้ว

    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

  • @vante6886
    @vante6886 ปีที่แล้ว

    Worked perfectly in mac M1, thank you!

  • @ngvi84
    @ngvi84 ปีที่แล้ว

    can u instruct me include glut library

  • @sc6ut407
    @sc6ut407 ปีที่แล้ว

    fuck this video it didnt work

  • @sl_ank
    @sl_ank ปีที่แล้ว

    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.

  • @abdulhakim9537
    @abdulhakim9537 ปีที่แล้ว

    Thank you so much bro

  • @4ndydev
    @4ndydev ปีที่แล้ว

    Simple and straight to the point, thanks!

  • @syi14
    @syi14 ปีที่แล้ว

    why i do not have the c/c++ compiler?

  • @HarvestrX
    @HarvestrX ปีที่แล้ว

    Buy a PC, Macs are garbage!

  • @joahnoub173
    @joahnoub173 ปีที่แล้ว

    Amazing thanks!

  • @ilt_RIAD65
    @ilt_RIAD65 ปีที่แล้ว

    i need help. my error is: error: invalid argument '-std=c++17' not allowed with 'C'. how do i right now

  • @siddhantmishra-d1f
    @siddhantmishra-d1f ปีที่แล้ว

    clang: error: no such file or directory: '/Users/siddhantmishra/Desktop/ OpenGl*.cpp' how to fix this error

  • @ankansaha3260
    @ankansaha3260 ปีที่แล้ว

    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..??

    • @Aaans-bd8ep
      @Aaans-bd8ep ปีที่แล้ว

      have you figured out how to solve this error? I have the same

    • @ankansaha3260
      @ankansaha3260 ปีที่แล้ว

      @@Aaans-bd8ep Yes, I did.

    • @ryanliu8665
      @ryanliu8665 ปีที่แล้ว

      how? lol @@ankansaha3260

    • @raghavav9097
      @raghavav9097 5 หลายเดือนก่อน

      { "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

    • @suryapratapsingh5487
      @suryapratapsingh5487 11 วันที่ผ่านมา

      @@ankansaha3260 how

  • @DeadManRising
    @DeadManRising ปีที่แล้ว

    dude speak louder, damn.

  • @adamspiano
    @adamspiano ปีที่แล้ว

    Thanks so much for this!!

  • @mrunalkadhane5883
    @mrunalkadhane5883 ปีที่แล้ว

    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

    • @ritikanankar7207
      @ritikanankar7207 ปีที่แล้ว

      did you solve the issue? am getting the same one

    • @johnyeap7133
      @johnyeap7133 8 หลายเดือนก่อน

      same

  • @aunesto17
    @aunesto17 ปีที่แล้ว

    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.

    • @notlikeyou5128
      @notlikeyou5128 16 วันที่ผ่านมา

      have u solved it? i got the same

  • @maxrathbone-boschis547
    @maxrathbone-boschis547 ปีที่แล้ว

    This is what I have been looking for ages, THANK!!

  • @fullViewJay
    @fullViewJay ปีที่แล้ว

    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

  • @somabencsik
    @somabencsik ปีที่แล้ว

    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!

  • @РусланКононов-ч9я
    @РусланКононов-ч9я ปีที่แล้ว

    Большое спасибо, добрый человек

  • @SlurpCode
    @SlurpCode ปีที่แล้ว

    I choose the same default build task however my args structure is different, is this normal and do I need to change it?

  • @ww25_td
    @ww25_td ปีที่แล้ว

    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?

  • @minanaji9597
    @minanaji9597 ปีที่แล้ว

    Works on M1 macbook! Thanks!

  • @nunzioturtulici9636
    @nunzioturtulici9636 ปีที่แล้ว

    I wanna say thank you! I would gone crazy trying to set up all without your video...thanks for sharing!