Download and install
Download address: https://www.fosshub.com/Code-Blocks.html
Download the first (with compiler)
Baidu network disk link:
Link: https://pan.baidu.com/s/12b0-R0n2JEoLMrF- TleAUw
extraction code: x7cx
When running for the first time, select the default compiler as shown below
Create project
The modified source file needs to be saved first (shortcut key ctrl+s, unsaved files have an asterisk before the file name), then click Build (if there is an error, the output box below will give information), and then click run. Or directly click "Build + Run"
to run the result
Project file structure tree
The .cbp file is the project file of the Code::Blocks software. When opening an existing Code::Blocks project, you can find the file in the software and open it. It is meaningless in other software. (covered in the Open Projects chapter)
.c or .cpp files are source code files and can also be used when pasted into other compiler software
The bin folder contains the .exe file (executable file), that is, the executable file generated after building and running
The obj folder contains .o files (object files). Those who don't understand the compilation and linking process of the c/c++ language don't need to care.
In general, what beginners need to understand is that .cbp is used to open the project, .c/.cpp is the source code file, and the bin contains .exe.
The root directory of the Code::Blocks compiler is the path where the .cbp file is located, and the root directory of the DevC++ compiler is the path where the .exe file is located. The meaning of the root directory is that if the "test.txt" file is placed in the root directory, the file name of fopen Just fill in the file name for the parameter, such as fopen(“test.txt”, “w”), otherwise you need to add an absolute or relative path before the file name, such as fopen(“C:\Users\Administrator\Desktop\Project1\ 'test.txt", "w")
Open project
(Click File -> Close project in turn to close the currently operating project and return to the main interface)
Main interface:
find the .cbp file and open it