Visual Studio Freedom
Some of my students want to learn to write C++ on a Windows OS. At some point, you simply surrender to the fact that many people prefer the Windows OS as a starting point. Traditionally, I’d recommend the Microsoft Visual Studio as their learning vehicle because it’s free to our students because of our relationship with Microsoft. It’s not free to graduates. When a graduate contacts me I recommend Code::Blocks. Just recently, one ask for more than a recommendation. He wanted instructions. These are the instructions.
Download and Install Code::Blocks
Here are the instructions to install and download Code::Blocks 13.12.
- You can download Download and Install Code::Blocks from the web site. Then, you can install Code::Blocks from download folder.
- You launch the
codeblocks-12.12mingw-setup.exe
file from the download folder.
- This is the first screen of the Code::Blocks wizard. Click the Next button to continue.
- This is the license agreement. Click the I Agree button to continue.
- This screen shows the components to install. The default has all of them checked. I recommend you keep the default. Click the Next button to continue.
- This screen lets you accept the default install location or to chose another install location. I recommend you keep the default install location. Click the Install button to continue.
- This screen shows you the extracting and deployment of files. Click the Next button to continue.
- This indicates that you’ve installed the product, and it now prompts you to run Code::Blocks programscreen shows you the extracting and deployment of files. Click the Yes button to continue.
- This indicates that the installer detects a GNU GCC Compiler. Click the OK button to continue.
- This acknowledges the completion of the installation. Click the OK button to continue.
- This dialog tells you the installation has completed. Click the Next button to continue.
- This dialog completes the installation. Click the Finish button to end the installation.
Configure Code::Blocks
- This is the main menu of Code::Blocks application. You need to click the Create a new project link to continue.
- You should choose a Console application for this example. Double click the Console application icon to continue.
- This dialog launches the Console page. Check the Skip this page next time and then click the Next button to continue.
- This dialog lets you choose whether you want to write a C and C++ program. Click the Next button to continue.
- This dialog lets you choose whether you want to write a C and C++ program. Click the Next button to continue.
- This dialog lets you choose the compiler, debug, and release configurations. Click the Finish button to continue.
Create and run a program in Code::Blocks
- This dialog gives you an empty project. Click the Sources item in the list of the Project tab.
- This dialog adds a main.cpp to the list of the Management console. Click the main.cpp item in the list of the Project tab.
- After clicking the main.cpp item in the Project list, the Code::Blocks IDE generates the content of the main.cpp file. Click the Green Arrow to run (compile and execute) the main.cpp file. The
endl
is a defined instd
, and like a\n
line terminator.
- A new file hasn’t been compiled (or built), which means you get the following dialog. It wants to know if you want to build the program. Click the Yes button to build the program.
- After making the file, the Build Log tells you whether the code compiles or not. Click the Run green arrow to run the program.
- After running a Console application, you’ll see the output of your program in a console window like the following. You can close it by clicking the console window’s close button.
- After executing the compiled file, the Build Log tells you whether the program compiles successfully or not.
As always, I hope this helps those who read it. Good luck learning to write C/C++ programs.