Compiled code::blocks in "code::blocks" Windows environment (fixed)

Source: Internet
Author: User
Tags svn update wxwidgets

Code::Blocks released the latest version of 12.11 in 2012-11-25, and Code::Blocks has made many improvements and updates (change log) compared to the previous version (10.05).

Reference wikipedia:code::blocks:

code::blocks is a free, open source, cross-platform IDE that is developed using C + + and uses wxwidgets as a GUI function library. Code::Blocks uses a plug-in architecture that can be expanded freely using plugins. At present, Code::Blocks is mainly designed for developing a/C + + program.

Code::Blocks currently supports a number of Windows, Linux and Mac OS x platforms. [1] users are also able to build code::blocks in the FreeBSD environment.

Code::Blocks, as a lightweight C + + IDE, is more suitable for newcomers than large Ides such as Visual Studio and Eclipse. Most of the Chinese university's C + + textbooks are still in the 1998 release of Visual C + + 6.0 (VC 6) for the IDE, it is entrap students. VC 6 has been released for more than 10 years, can not effectively compatible with Windows 7/8 System, does not support the latest C + + standards, recommend you abandon it as soon as possible!

Download Code::Blocks:

It is recommended to download the Codeblocks-12.11mingw-setup.exe version with the MinGW compiler, and the version without the compiler requires a manual configuration of the compiler.

About Chinese:

1. Code::Blocks Official language internationalization project, but the project template provided is still established in 2006-06-30, including only 2,173 entries, completely unable to meet the latest version of the 8,000 or so entries (rough estimate), so it is not recommended.

2. The 10.05 version of the code::blocks has a good Chinese language pack, in the use of this version of the students can download (containing the use of help, no longer explained).

3. For the 12.11 version of the Chinese work is still no one, but some comrades have been insisting on the international work of French, from which he can learn some code::blocks language internationalization technology. (for the new version of the Chinese work, I am more interested in the preparatory work is still in progress, I hope to have a result!) )

OK, said a lot, return to the point.

The detailed introduction to compiling code::blocks in Windows refers to Code::Blocks wiki:installing code::blocks from source on Windows.

Steps to compile the source code:

1. Install the latest version of the Code::Blocks, because it is necessary to compile the Code::Blocks source code (prohibit the association of "Chicken eggs and egg-born chicken" topic);

And precautions have been given above, no longer described in detail. The basic use of code::blocks is similar to that of most Ides and will not be mentioned.

2. Download and compile wxwidgets, because the GUI part of Code::Blocks needs to refer to this library;

WxWidgets is an open source, cross-platform C + + GUI library, please refer to wikipedia:wxwidgets for details.

The compilation process is long and takes more than half an hour, and I compiled it 3 times before it succeeds. If you do not want trouble, you can directly download my release, decompression can be.

: WxWidgets Stable for Windows

Extract the downloaded wxmsw-2.8.12.zip to the H packing directory (choose according to your own situation);

Compiling requires the MinGW compiler, because the code::blocks we have installed already contains this compiler, so there is no need to reinstall it.

The installation directory for Code::Blocks is: H:\Program files\codeblocks,mingw directory is: H:\Program files\codeblocks\mingw. If you frequently compile the code for C/+ +, you can add the following two paths to the system's global variables: H:\Program files\codeblocks\mingw\bin; H:\Program Files\codeblocks\mingw\mingw32\bin;

The compilation begins.

First, to prevent the memory from being insufficient when connecting:

If you were using a recent version of MinGW you could find that the object files is too large and that the linker runs out O F memory. To fix this problem your need to edit config.gcc so, inline functions is not exported, by modifying the CFLAGS and CXX FLAGS lines to:

CFLAGS? =-fno-keep-inline-dllexport

Cxxflags? =-fno-keep-inline-dllexport

The above modifications need to be made to the H:\WXMSW-2.8.12\BUILD\MSW/CONFIG.GCC. Open the CONFIG.GCC with any text editor and make changes.

Open a command Prompt window and switch to the current directory:

CD/D H:\WXMSW-2.8.12\BUILD\MSW

Set temporary environment variables (if the MinGW environment variable has been set in the previous step, skip to the next steps):

Set Path=h:\program files\codeblocks\mingw\bin; H:\Program Files\codeblocks\mingw\mingw32\bin;

It takes about 30 seconds to execute the command:

Mingw32-make-f makefile.gcc shared=1 monolithic=1 build=release unicode=1 Clean

It takes about 30 minutes to execute the command, and there will be more than 20 warnings, ignoring it:

Mingw32-make-f makefile.gcc shared=1 monolithic=1 build=release unicode=1

After the end, the H:\wxMSW-2.8.12\lib\gcc_dll directory will be generated Wxmsw28u_gcc_custom.dll this is what we need.

3. Update Code::Blocks source code through SVN or download the packaged source code;

Packaged source code can be downloaded from here, SVN update the source of the way you can refer to here. We used the packaged source codeblocks_12.11-1.tar.gz.

Extract the source code to H-disk, modify the directory name codeblocks-12.11release8629 to codeblocks, to facilitate operation.

4. Load the source project, set the global variable, and start compiling.

Open the project file H:\CODEBLOCKS\SRC\CODEBLOCKS.CBP with the code::blocks already installed;

A popup window will be requested to set the environment variable (if there is no pop-up window, execute menu settings->global Variables ... Can):

This parameter is used to specify the publication type, see what goes in Cb_release_type.

Can be filled in:

-G represents debug (Debug) or

-o2 with Table optimised (optimized)

And then you start compiling. (The official wiki says to choose Build-target as Compiler, this may be wrong, friends in the Forum recommend all)

Without an accident, you will eventually see the following message:

|=== Build finished:0 errors, 438 warnings (7 minutes, 8 seconds) ===|

Represents a successful compilation.

5. Integrate the resource files to create your own code::blocks distribution.

First, copy the H:\wxMSW-2.8.12\lib\gcc_dll\wxmsw28u_gcc_custom.dll to the H:\codeblocks\src\devel directory to ensure that the published version has a wxwidgets operating environment;

Then, you need to consolidate all the resource files: Open a command Prompt window, go to directory H:\codeblocks\src, run Update.bat, wait for the end;

The second step is to create a new directory H:\codeblocks\src\output, which is your distribution. However, it is not equipped with a compiler.

Run it and look at the effect!

If you encounter any problems during the compilation process, please feel free to discuss this message.

Article from Learnshare, reproduced please specify.

Compiled code::blocks in "code::blocks" Windows environment (fixed)

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.