These days, it's very easy to add any amount of Launch (Run and/or Debug) configurations to the built-in Launch + Debugger UI by following these instructions. vscode/ folder (if not their entire project setup). You might want to check out their entire. I also found an example by someone taking a jab at OpenGl cross-platform compilation using VSCode here. I don't have recent examples or experiences of compiling on non-MAC systems but here are some relevant references:Īpparently cross-platform development still might cause some headaches, according to this (as of yet) open github issue #1083.
However, the bigger problem is usually how to get it to compile. Make sure that, once you have setup the C/C++ extension correctly, to look at the documentation for your environment, which are at the bottom of the official "C/C++ for Visual Studio Code" documentation page.
Then I followed their link at the bottom: Using Clang in Visual Studio Code (the GCC setup is very similar).I also started with the official VSCode instructions on C++ programming with VSCode (which you also mentioned).The above is just a shorter version of my overall journey, detailed below: Integrate that insight with the official documentation on C/C++ tasks, and it's all done! :) More Details (and again: it would be very similar when using clang or clang++) Don't forget: Add those frameworks to your C/C++ extension settings and/or tasks.json as well.gcc -o ex1 ex1.c -framework GLUT -framework OpenGL -Wno-deprecated.In order to run, add framework to your build arguments (to include external libraries), e.g.Mac has for part of it, and for glut files) TL DRĪs this Github Gist and this StackOverflow post both suggest: The main issue for me was that I am on MAC and many explanations were only targeted at Linux and Windows (which don't have the framework parameter) or they explain how to set it all up in the Xcode GUI.
Compilation depends on the OS and environment. What commands to use to compile the code?.The tasks documentation explains how to setup and run tasks in greater detail.Start with the official VSCode documentation on C++ programming with VSCode.How to setup the launch.json and tasks.json files?.