Theusualtype
Posts: 1
Joined: Mon May 27, 2013 2:57 pm

Newbie C++ Compiler

Mon May 27, 2013 3:03 pm

Hi Guys, I'm relatively new to programming in general and during my Summer break from College I want to learn some C++. I already know the basics of Java.
Can anyone tell me which compiler I should use for C++ or even if there is one on Weezy already?
Thanks in advance.

jpc
Posts: 18
Joined: Tue Mar 26, 2013 3:32 am

Re: Newbie C++ Compiler

Mon May 27, 2013 7:15 pm

Most Linux distros, like Raspbian, come with the GNU Compiler Collection. The C compiler is invoked on the command line with gcc, and the C++ compiler is invoked with g++.

If learning C++, I recommend starting with some basic C. Read through "The C Programming Language" doing as many exercises asyou can. Personally, I think every programmer should begin with this book, but that is highly subjective... There are many great resources out there.

Another thing: you will find that as your code becomes larger, the RPi will take quite some time to compile. Look into installing a cross compiler on a faster computer.

Best wishes,
Jim

RPiJunior
Posts: 21
Joined: Tue May 07, 2013 6:12 pm

Re: Newbie C++ Compiler

Fri May 31, 2013 10:16 am

jpc wrote:Most Linux distros, like Raspbian, come with the GNU Compiler Collection. The C compiler is invoked on the command line with gcc, and the C++ compiler is invoked with g++.

If learning C++, I recommend starting with some basic C. Read through "The C Programming Language" doing as many exercises asyou can. Personally, I think every programmer should begin with this book, but that is highly subjective... There are many great resources out there.

Another thing: you will find that as your code becomes larger, the RPi will take quite some time to compile. Look into installing a cross compiler on a faster computer.

Best wishes,
Jim
K&R is an epic book! Just the way I learnt C then C++.

Code: Select all

int main() {
    try
        throw "off table";
    } catch (void e) {
        printf("Phew...");
    }
}
WARNING: I destroy! :twisted:

Alec
Posts: 24
Joined: Sat Jan 14, 2012 8:18 pm
Contact: Website

Re: Newbie C++ Compiler

Fri May 31, 2013 12:14 pm

Depending on how far you expect to go w/ C++, you might like to consider the version to chose: C++98 (and 03), the traditional, legacy version (and the default version w/ gcc); and/or C++11, the latest and greatest (also supported by recent versions of gcc, if you invoke it appropriately).

One benefit of the former choice is that there is a _huge_ choice supporting tutorial material. Another is that legacy codebases use the traditional facilities and styles. A benefit of the C++11 choice is that it can be even more expressive and efficient; and has a more comprehensive standard library. Also, it represents the future of C++.

The C->C++ learning route offers some benefits. As does the alternative approach espoused by Andrew Koenig and Barbara Moo in their "Accelerated C++" book; that is, learn by solving problems, using standard C++ library facilities. (I.e. design and code at a higher level, and let the library do the heavy lifting.) This approach is also recommended by Stroustrup.

Return to “C/C++”