Install CodeBlocks in CentOS
1. Installation Platform description:
CentOs6.4-i686 gcc-4.4.7
Ii. download the latest source code:
Http://www.codeblocks.org/downloads
The latest version: Code: Blocks 16.01 is installed here.
3. Read the official installation instructions:
Http://wiki.codeblocks.org/index.php/Installing_Code::Blocks_from_source_on_Linux
You can obtain the following information by reading the official installation instructions:
Installing CodeBlocks has the following dependencies:
Code: Blocks-> xwWidget (> libwxGTK2.8)-> GTK + (> libgtk-x11-2.0)-> X
That is to say first to install the X system, that is, the desktop, and then install the libgtk-x11-2.0, and then install libwxGTK2.8, and finally start the source Code installation Code: Blocks.
4. Install the SDK in sequence based on the preceding dependency:
1. Create a directory:
Mkdir ~ /Devel // create the devel directory in the home directory. You can specify the directory name as needed.
2. Install GTK + (libgtk-x11-20) Library:
Yum install gtk + *
3. Install the wxGTK (libwxGTK2.8) library in the source code:
Download wxGTK source code:
Https://sourceforge.net/projects/wxwindows/files/2.8.7/
Make sure to select the following source code package:
Copy the downloaded source code to the directory created earlier :~ /Devel/, and decompress:
1 mv./Desktop/wxGTK-2.8.12.tar.gz devel // copy the Desktop wxGTK source package to the created working directory devel
2 cd devel // enter the devel directory
3 tar zxvf wxGTK-2.8.12.tar.gz // extract source package
Go to the wxGTK-2.8.12 directory and execute the following command:
Mkdir build_gtk2_shared_monolithic_unicode // create a compilation directory
Cd build_gtk2_shared_monolithic_unicode // enter the newly created directory
../Configure-prefix =/opt/wx/2.8-enable-xrc-enable-monolithic-enable-unicode // execute the configure script file
Make // start Compilation
Su // switch to root
Make install // start Installation
The installation process is as follows:
After performing the preceding steps, you can see that the Makefile has been generated. Now you can make the compilation:
Make // start Compilation
After compilation is complete, start to install make install:
Su root // switch to the root user
Make install // start Installation
The following message indicates that the wxGTK library has been installed successfully:
4. After all the preparations are completed, install Code: Blocks:
Copy the CB source code to the working directory we created earlier :~ /Devel, and then enter the source code directory:
Mv ../Desktop/codeblocks-16.01.release // copy the codeblocks source package to the current directory (devel /)
Cd codeblocks.16.01.release // enter the source code directory
Copy wxwin. m4 under the wxGTK-2.8.12 to/usr/share/aclocal:
Cp wxwin. m4/usr/share/aclocal // copy wxwin. m4 under the wxGTK-2.8.12 to/usr/share/aclocal
Go to the CodeBlocks source code directory and run./bootstrap:
./Bootstrap
Start to execute the configure script:
// Note that the path/opt/wx/2.8/bin/wx-config here should be the path for wxGTK installation.
./Configure-with-wx-config =/opt/wx/2.8/bin/wx-config
Start Compilation: make
Make // start Compilation
Switch to root for installation:
Su root // switch to the root user
Make install // start Installation
You can see that CodeBlocks has been installed successfully:
5. Start CodeBlocks:
1. Start through the command line:
All the above steps install CodeBlocks on the linux system, but the problem may occur when we start it directly:
The reason is that the dynamic link library of the libwx_gtk2u-2.8.so.0 cannot be found.
The solution is as follows:
Vim/etc/profile
// Add the following environment variables to the end of the file:
// Note that the/opt/wx/2.8/lib path here should be the path for wxGTK installation.
Export LD_LIBRARY_PATH = "$ LD_LIBRARY_PATH:/opt/wx/2.8/lib
Save and run: source/etc/profile to make the configuration file take effect immediately.
The final command line starts CodeBlocks successfully:
2. Start with the desktop icon:
By default, the desktop cannot be started by double-clicking because there is no icon on the desktop after installation. In this case, we need to create the initiator:
Right-click the desktop and choose CreateLaucher:
Enter the following information and click OK:
The codeblocks icon is displayed on the desktop. You can double-click it to start it (note:If the system cannot be started by double-clicking, restart the system ):
6. Test the normal operation of the new project:
At this time, the compilation is successful, but the console window cannot be displayed during runtime:
The reason is that CB uses xterm by default instead of the gnome console. The solution is as follows: Setings-> Environment
At this time, when you click the execute button, everything is normal:
VII. References:
Http://wiki.codeblocks.org/index.php? Title = Installing_Code: Blocks_from_source_on_LinuxCodeBlocks official tutorial
Http://www.cnblogs.com/zhanjindong/archive/2013/05/05/3061108.htmlcsdnblog