Test file Test.cpp
#include <iostream>
using namespace Std;
int main () {
cout << "!!! Hello World!!! "<< Endl; Prints!!! Hello World!!!
return 0;
}
1. Install the C + + compilation environment and ensure that the g++ Test.cpp is entered at the command line to generate the binary files correctly
I. Install Xcode, AppStore can be down to. At this time g++ can be used, but iostream,stdio.h and other files are not, because the relevant command line tool is not installed complete (PIT Dad!! )!
Ii. Installing the complete g++ command-line tool
Xcode->open developer tool-> more developer tools ...
This will jump to the Apple website and download the latest version of command line Tools (OS X XXXXX) for Xcode, install
OS X name, on the Apple->about this Mac can find the OS version number, and then according to the version number to google its name, we 10.9.3 called Mavericks)
After the installation is complete, a variety of familiar header files such as stdio.h and a directory C + + will appear under/usr/include
At this time the command line execution g++ test.cpp, all errors disappear, finally can be successfully compiled
2. Install eclipse, download the website
3. Install the CDT:
In Eclipse->help->install New softerware.
Enter the CDT download Url,http://download.eclipse.org/tools/cdt/releases/juno in the top URL,
The CDT Main Features and CDT Optional Features appear, open, select the items you want to install, install
Restart the eclips, C + + Project appears under File->new->, CDT installation is complete
4. Setting the CDT
Under Eclipse, project->properties->c/c++ general->paths and Symbols
GNU C is set to/usr/include
GNU C + + is set to/usr/include/c++/version number
5 Restart Eclips, create a new C + + project, add the above test files, Build,run, done!
Install ECLIPSE+CDT under Mac