Coding & programming
Installing CodeBlocs compiler
C language
C++ language
© The scientific sentence. 1998-2016
| Â |
|
Programming with C/C++ Language
Installing codeBlocs compiler to run
C and C++ programes
1. First step: Set Up a C/C++ Compiler
The very first thing you need to do, before starting out in C or
C++, is to make sure that you have a compiler.
A compiler turns the program that you write into an executable
that your computer can actually understand and run.
Working under Windows, we will use Code::Blocks with MinGW.
On UNix or Solaris, or Linux, we can use g++, and on Mac OS X, we can use XCode.
The old compiler Turbo C++ might need to set some compatibility issues.
2. Installing Code::Blocks and MINGW compiler to run
C and C++ programs
Code::Blocks is a free development environment for C and C++. Its
MINGW is a GCC GNU Free C and C++ Compiler, on Windows.
The MINGW compiler is a tool that will turn the code that
we write into programs.
How to install Code::Blocks on Windows 2000, XP, Vista or Windows 7 ?
Step 1: Download Code::Blocks
• Go to the website:
http://www.codeblocks.org/downloads
• Follow the link to "Download the binary release" :
direct link
• Go to the Windows 2000 / XP / Vista / 7 section
• Look for the file that includes mingw in the name.
(The name as of this writing was codeblocks-16.01mingw-setup.exe;).
• Save the file to your desktop. It is roughly 75 megabytes.
Make sure that you downloaded the right version of Code::Blocks,
the one that included MinGW.
Step 2: Install Code::Blocks
• Double click the installer.
• Hit next several times.
• The default install location is C:\Program Files\CodeBlocks,
we may install elsewhere if welike
• Do a Full Installation
• Launch Code::Blocks
Troubleshooting
It is likely a problem with compiler auto-detection. Here's how you
can check your current "auto-detected" state.
• Go to "Settings, then Compiler
• Choose Toolchain executables
• We can use the "Auto-detect" button .
.. that might fix a problem
Once you've done that, try pressing F9 again to see if you get a running program.
3. Setting the path environment in Windows XP
• Choose: Start → Setting → Control Panel → System →
• Click on Advanced →Environment variables , then add at the path:
C:/Program Files/CodeBlocks/MinGW/bin
4. On the prompt
We can use the command line to make executable as follow:
For C:
Make executable:
g++ -o test test.c
To compile:
test
For C++:
Make executable:
g++ -o test test.cpp
To compile:
test
Have fun,
|
  |