Back on the Raspberry Pi

Pi Asteroids DevelopmentIt has been a few months since I last used it and as you’d expect, it took a little bit of time and effort to get things back to what they were.

I’m pretty good about backing things up and it took about 30 minutes to burn a new SD Card, update it, install VS Code and the C/C++ extension, then copy my asteroids version over. I use WinSCP so had to enable SSH on the PI. It’s disabled by default but just tick a checkbox on the interface tab of the Preferences->Configuration menu.

Even then it didn’t compile. Of course I had to reinstall the dev versions of SDL, SDL_image, SDL_mixer and SDL_ttf and the clang compiler. Still it didn’t compile. I had created a Projects folder and created an Asteroids folder underneath that. I also had the Vs Code JSON files that you need for compiling C/C++. the main one of which is tasks.json. Those were in a folder .vscode which I had backed up but I’d copied it over into the wrong location. You want it located inside your VS Code folder.

This makes sense. If you have say five different projects then you are going to have a different build, link stuff per project. So you’ll have a unique .vscode in each folder. When you want to switch projects, you just close the Folder in the VS Code File menu and open it in the folder for the project that you next want to work on.

Mind you it still wouldn’t compile. It turned out my tasks.json has clang-6 in it. When I did a clang –version on it, it told me it was clang 7.0.1. So I upped it to clang-7 in tasks.json and that fixed it. It all compiled and ran.

Once you’ve done this a time or two it becomes 2nd nature but I can understand novices frustration; there are a lot of moving parts that all have to be right before you can even write and run C code. It’s not like other programming languages are really any better though. If you have setup virtual environments in Python and installed Python modules, you’ll know what it can be like.

 

(Visited 4 times, 1 visits today)