Code: blocks Configuration

Source: Internet
Author: User

1. in advance
We should be familiar with the relationship between C language and Linux. the Linux kernel is developed in C language.
C compilation and debugging tools will be available, but these tools are imperative and will be inconvenient for formal development. We want a fast, flexible, and powerful C Development
Environment.
Code: blocks is a cross-platform C/C ++ IDE. Supports windows, Linux, and Mac operating systems and multiple compilers, such
Microsoft C, gnu c, Borland C, Intel C, etc.
C version. In Linux, we don't need to attach it because the system has already been ready for us. Now let's install and try this IDE.

Ii. Configuration
After the installation is successful, go to the main menu --> programming --> code: blocks ide To enter the IDE. The first time you open the software, it will automatically detect the C compiler in the system, generally, gnu c is automatically detected in Linux.

Figure 1: Automatically detect the built-in Compiler
After detection, click OK to enter the software environment and you will see the code: blocks interface.


Figure 2: Code: blocks default Interface
Do you think the toolbar on the window is messy? Drag it as you like and immediately become neat.

Figure 3: Adjusted page
On Dave's machine, the path of the compiler detected by code: blocks is so problematic that the program cannot be compiled and the system bug is unknown. Therefore, we need to further check
Check the compiler path. Click settings --> compiler and in the menu bar.
Debugger... enter the compiler and debugger Setting Dialog Box to see if selected compiler is the compiler you want to use.
C, so the GNU gcc compiler is displayed here.

Figure 4: Default gnu c Compiler
Then, click the arrow next to search directories four times to bring the tag to toolchain.
Executables, and then observe Compiler's installation directory
The text box below shows the path of your compiler. GNU under Fedora
The default C path is under/usr/bin, and/usr/bin is displayed here. (If/usr is displayed, it indicates that your settings are correct ), the following red line indicates that the compiler must
In the bin directory. Note: The Directory here cannot be/usr/bin. If/usr/bin is entered, code: blocks will be compiled under/usr/bin.
But the default setting of the software is/usr/bin. This is a very bad bug. Enter/usr here and exit.

Figure 5: Use the/usr path
Because code: blocks uses xterm as the console interface for running the program by default, this software is not installed by default in fedora, and this item is also an antique item. It is not installed by default.
Supports Chinese characters. We can use gnome-terminal (console in GNOME Desktop Environment) as the default console. If you are using the KDE Desktop Environment, you can select KDE
Console. Click settings --> environment... in the menu bar to go to environment settings. In the displayed dialog box, you can see a line below:
Terminal to launch console programs:
The content of the text box on the right is:
Xterm-T $ title-e

Figure 6: Environment setting page
Change the text box content:
Gnome-terminal-T $ title-x
You can change the running console to the console that comes with Gnome.

Iv. Trial Run
The long-awaited time has finally arrived. The following is to run the hello World Program. Click Fiel --> New --> project... in the menu bar to pop up
The new project dialog box contains different types of projects. We select console application and click go to create a new console program.

Figure 7. Create a console Project
The following shows a useless window for creating a program. You can go to the skip this page next time
Check the above to make this annoying reminder to see God. Next, the next part is to let you select the language type. Here we select C to compile the C language program (in fact, C ++ can also be used to compile the C language program)
--!), Next step. Enter our project name in the text box under project title. Here I write the ctest; folder to create
Project in: Enter the project path below. Here I use/home/Dave/cbwork. It will be automatically filled in the remaining two text boxes, regardless of whether it is directly next.

Figure 8. Set the project path and name
Then, select the compiler and two project settings. After confirming the settings are correct, click Finish. At this time, code: blocks will display the created Project to the mangement column on the left of the main window, which contains a main. c default file, click to open, you will find Hello world! The program has been written.

Figure 9. Created projects and documents
At this time, click the "Gear arrow" icon on the top of the screen to compile and run the program.

Figure 10. xterm Running Effect

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.