Starting C++ Programming
C++ (pronounced "cee plus plus") is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features
Installing c++/g++ on Windows
Follow these steps to install g++ (the GNU C++ compiler) for Windows.
Pick the drive and a folder in which you want to install g++. I'll assume that it is C:, but you can choose a different one. If you choose a different drive or a different folder, you'll need to adapt the directions below accordingly.
- Download full.exe, an about 14 megabyte executable, to C:\full.exe by right-clicking on the link. Use Save Link As... or Save Target As... Be sure the browser saves the file as C:\full.exe. (http://www.claremontmckenna.edu/pages/faculty/alee/g++/full.exe)
- Run
the downloaded executable. This will install g++ (and a lot of other
things that you don't really need) on your hard drive. Go to the C: drive using Windows Explorer and double-click on full.exe. Or, open a DOS window (Start > Programs > Command Prompt), connect to the C: drive using the cd command, and type full.
- Locate where the bin folder was created for the g++ installation. On my Windows XP machine, it was created in the following path:
- C:\cygnus\cygwin-b20\H-i586-cygwin32\bin
You now should add it to the PATH environment variable. You do that by following:
Start -> Control Panel -> System -> Advanced -> Environment Variables
At this point you can see the PATH variable either in the User Variables or in the System Variables. Add the g++ path into the PATH variable. You add it to the end of the existing
value separated by a semicolon (';'). Make sure that you do not lose
the original value. You are just appending more to the end separated by a
semicolon.
- Restart your computer. A Cygnus Solutions entry will appear in your Programs menu, and an icon may appear on your desktop. Don't use them! You will use it using the g++ command on a DOS prompt as explained below.
You should now be able to run g++ from a DOS (Command Prompt) window. For example, to compile a file called C:\helloworld.cpp,
helloworld.cpp
#include <iostream> using namespace std; void main() {cout << "Hello World!" << endl; cout << "Welcome to C++ Programming" << endl; } |
g++ -g helloworld.cpp -o helloworld –lm (this command will produce helloworl.exe file)
You'll then be able to run the compiled program by entering helloworld in the DOS window.
If you'd like to learn more about where this free compiler came from, we downloaded it from an older site of http://sourceware.org/cygwin/.
If you wish to clean up a little, you may delete the file: full.exe at this point. Your g++ compiler is installed under C:\cygnus.
Reference :- http://www.claremontmckenna.edu/pages/faculty/alee/g++/g++.html
Installing Eclipse for C /C++ Programming
Download Eclipse IDE for C/C++ Developers http://www.eclipse.org/downloads/
http://www.youtube.com/watch?v=rgt3PJ5DvH4&feature=related
Introduction
Eclipse is an open source community whose projects are focus on building an extensible development platform, runtimes and application frameworks for building, deploying and managing software across the entire software lifecycle.
Here you will find instructions to install the Eclipse Integrated Development Environment for C/C++ Developers and to configure it for the development of Tonatiuh.
Installing the Eclipse IDE for C/C++ Developers
Download the latest version of the"Eclipse IDE for C/C++ Developers" from the Eclipse website. To do it, click on the following link to go to the "Downloads" webpage of the Eclipse website. Once you reach the webpage, click on the appropriate version (Windows 32 Bit or Windows 64 Bit) of the link titled "Eclipse IDE for C/C++ Developers" (see Figure 1). Then follow the instructions to select a mirror site from where to download the compressed package file. When prompted, select the appropriate option to store the file in your computer. Currently, the latest version of the compressed package file is titled "eclipse-cpp-indigo-incubation-win32.zip".
Once the IDE for C/C++ Developers compressed package file is in your computer, right-click upon it to extract its content. Move or copy the"eclipse" folder into the folder "C:\sde\"
Now, go to the folder "C:\sde\eclipse" and run the program "eclipse.exe". When asked for a workspace, set it to "C:\sde\workspace".
Configuring the Eclipse IDE for C/C++ Developers for developing Qt applications
On the Eclipse main menu select "Window" and within it "Preferences". This will triger a pop-up dialog titled Preferences", which can be used to adjust different Eclipse options. In the left tree-like view of the preferences dialog select "General\EditorsªFile Associations" (see Figure 1). In the dialog's "File Associations" right view, within the "File types" window, add the new types:
- .ui C:\sde\Qt\Desktop\Qt\version\mingw\bin\designer.exe
- .ts C:\sde\Qt\Desktop\Qt\version\mingw\bin\linguist.exe
And within the "Associated editors" window, associate this file types with the following programs, respectively:
- C:\sde\Qt\Desktop\Qt\version\mingw\bin\designer.exe
- C:\sde\Qt\Desktop\Qt\version\mingw\bin\linguist.exe
![]() |
Figure 1. View of the Eclipse IDE and the "Preferences\File Associations" dialog. |
Configuring the Eclipse IDE for C/C++ Developers for using the MinGW compiler
On the Eclipse main menu select "Window" and within it "Preferences" to display the pop-up dialog Preferences". In the left tree-like view of the preferences dialog select "C/C++\New CDT Project Wizar\Makefile Project" (see Figure 2). In the dialog's "Makefile Project" right view, do the following:
- Under the "Binary Parsers" tab, select only "PE Windows Parser"
- Under the "Builder Settings" tab, uncheck the "Use default build command" and set the build command to "C:\sde\MinGW\bin\mingw32-make.exe"
![]() |
Figure 2. View of the Eclipse IDE and the "Preferences\Makefile Project" dialog. |