Configuring VS Code for C/C++
Most of the time I’ve got by configuring VS Code but recently I wasted an hour having managed to completely mess it up. I have a Raspberry Pi version of Asteroids which adds temperature display and game pad support. It’s a useful way to check when I burn a new SD and install VS Code, clang, and all the libSDL2-dev codes that everything is there. If it’s not it won’t compile.
Only this time because I was doing other stuff I decided to create a Projects folder which contained the Asteroids folder and some other stuff and opened Projects as the Folder. I copied the hidden .vscode folder into Projects/Asteroids and tried to compile. Errors. Lots of compile errors. I repeatedly edited the tasks.json file with altered paths but no joy. I spent an hour trying before closing the Folder and reopening it with Asteroids as the Folder and with the original tasks.json. It compiled perfectly.
So the moral of the tale is just keep the level of folders down to one when you open the Folder on the files you are compiling. Do not have subfolders.