C++ for programming


#1

Is it possible to program the BrickPi in C++? If yes, would I be able to write the code in Microsoft Visual C++, and then compile and run the code via the terminal window like you did in the tutorial video?


#2

RobotMaster,
In theory it’s possible, but we don’t know much about it. What compiler would you use on the Raspberry Pi?


#3

I would use Windows Command Prompt to compile the code, and I would use Microsoft Visual Studio to write the code. I don’t know the command to compile the code though. I know gcc is for C programs, but I’ve never compiled in the Command Prompt before, because I’ve always used Microsoft Visual Studio to compile my programs.


#4

Since the Raspberry Pi runs Linux (Debian), Microsoft Visual Studio C++ is no use for programming it. I very much doubt that Visual Studio would cross compile to produce a Linux executable. MS VS only produces executables for MS Windows.

Gcc compiles C++ very well. It is highly standards compliant and has a few GNU C++ extensions that improve on the standards, and are optional to use. The compiler command is g++, and C++ source files are conventionally named foo.cc or foo.C or foo.c++ or foo.cpp. Read the g++ manual for more information.