I learned C + + in my freshman years, but I forgot about it, and seldom used it. The Windows system was used, or Visual C + +. At that time, the computer did not have a cold, and did not study well. Recently in the study of R encountered bottlenecks, think to pick up the once C + +. Now the time has changed, the system for Mac, the previous knowledge has already forgotten all, can only start again.
1. IDE
It's good to choose Eclipse CDT. A few notes:
A. Inconsistencies in C and C + +:
If you create a source file, the end of C is. c, and C + + files end With. cpp;
The syntax is inconsistent, and the simplest Hello world can see:
//C + + code#include<iostream>using namespacestd;intMain () {cout<<"!!! Hello World!!!"<< Endl;//Prints!!! Hello World!!! return 0;}//C Code#include <stdio.h>//". h" must is added for CMain () {printf ("Hello World");}
B. Compiler selection:
Select MacOSX GCC to
Sometimes the compiler has some problems, it is said to be related to MacOS system, try to double-click binary file on work
If you are compiling directly with the compiler, be aware of the differences between C and C + + files:
GCC file g+ + HelloWorld. CPP file
C&c++ Recap