Code:Blocks and MinGW Configuration and Projection Integration based on WXWidget2.9.1

First of ALL, i record this documents for the begginer of the Code:blocks and Mingw or GCC compliant compiler..

And also the people who eager to share in the open community and cross platform development.

 

 

Before you said that hard, please know the following common reality about the C: B. & WXwidget

 

1.WXwidget need compiler before you start your hello world, please download the newer or stable wxwidget version from

http://www.wxwidgets.org/

 

and there a forum to help you indentify some issues.

 

but please read the documents about the compiling issue in the <yourwxwidget>/docs/msw/install.txt.

 

following the command can help you on various compiler.

 

2.C:B suggest to get a binary build from http://www.codeblocks.org/

Donot wait time to compile a SVN version.

There also a forum there to help you identified your questions and more efficient than the wxwidget :)

 

3. migrate your project from your older version wxwidget and older version C:B

there a bug, the project file cannot update to date to reflect the comipler change, if you also update the C:B version.

so you have to manually handle on the .cbp file(project file)'

 

here is a valid project file, if you found there strange thing happend when you try to compile the project and your

configuration is settled down, error like "prexxx.h not included,,, xxx is undefined, can not reference to xxxx".

 

you also can create a new widget project and compare with the older one....

 

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
    <FileVersion major="1" minor="6" />
    <Project>
        <Option title="EHProxy" />
        <Option pch_mode="0" />
        <Option compiler="gcc" />
<Build>
            <Target title="Debug">
                <Option output="bin/Debug/EH02" prefix_auto="1" extension_auto="1" />
                <Option object_output="obj/Debug/" />
                <Option type="0" />
                <Option compiler="gcc" />
                <Option projectLinkerOptionsRelation="2" />
                <Compiler>
                    <Add option="-g" />
                    <Add option="-D__WXDEBUG__" />
                    <Add directory="D:/wxWidgets-2.9.1/lib/gcc_dll/mswud" />
                </Compiler>
                <ResourceCompiler>
                    <Add directory="D:/wxWidgets-2.9.1/lib/gcc_dll/mswud" />
                </ResourceCompiler>
                <Linker>
                    <Add library="libwxmsw29ud_core.a" />
                    <Add library="libwxbase29ud.a" />
                    <Add library="libwxpngd.a" />
                    <Add library="libwxjpegd.a" />
                    <Add library="libwxtiffd.a" />
                    <Add library="libwxzlibd.a" />
                    <Add directory="D:/wxWidgets-2.9.1/lib/gcc_dll" />
                </Linker>
            </Target>
            <Target title="Release">
                <Option output="bin/Release/EH02" prefix_auto="1" extension_auto="1" />
                <Option object_output="obj/Release/" />
                <Option type="0" />
                <Option compiler="gcc" />
                <Option projectLinkerOptionsRelation="2" />
                <Compiler>
                    <Add option="-O2" />
                    <Add directory="D:/wxWidgets-2.9.1/lib/gcc_dll/mswu" />
                </Compiler>
                <ResourceCompiler>
                    <Add directory="D:/wxWidgets-2.9.1/lib/gcc_dll/mswu" />
                </ResourceCompiler>
                <Linker>
                    <Add option="-s" />
                    <Add library="libwxmsw29u_core.a" />
                    <Add library="libwxbase29u.a" />
                    <Add library="libwxpng.a" />
                    <Add library="libwxjpeg.a" />
                    <Add library="libwxtiff.a" />
                    <Add library="libwxzlib.a" />
                    <Add directory="D:/wxWidgets-2.9.1/lib/gcc_dll" />
                </Linker>
            </Target>
        </Build>
        <Compiler>
            <Add option="-pipe" />
            <Add option="-mthreads" />
            <Add option="-D__GNUWIN32__" />
            <Add option="-D__WXMSW__" />
            <Add option="-DWXUSINGDLL" />
            <Add option="-DwxUSE_UNICODE" />
            <Add option='[[if (PLATFORM == PLATFORM_MSW &amp;&amp; (GetCompilerFactory().GetCompilerVersionString(_T(&quot;gcc&quot;)) &gt;= _T(&quot;4.0.0&quot;))) print(_T(&quot;-Wno-attributes&quot;));]]' />
            <Add option="-Wall" />
            <Add directory="D:/wxWidgets-2.9.1/include" />
            <Add directory="D:/wxWidgets-2.9.1/contrib/include" />
        </Compiler>
        <ResourceCompiler>
            <Add directory="D:/wxWidgets-2.9.1/include" />
        </ResourceCompiler>
        <Linker>
            <Add option="-mthreads" />
        </Linker>
        <Unit filename="EHProxyApp.cpp" />
        <Unit filename="EHProxyApp.h" />
        <Unit filename="EHProxyMain.cpp" />
        <Unit filename="EHProxyMain.h" />
        <Unit filename="OptionDialog.cpp" />
        <Unit filename="OptionDialog.h" />
        <Unit filename="resource.rc">
            <Option compilerVar="WINDRES" />
        </Unit>
        <Unit filename="wx_pch.h">
            <Option compile="1" />
            <Option weight="0" />
        </Unit>
        <Unit filename="wxsmith/EHProxyframe.wxs" />
        <Unit filename="wxsmith/OptionDialog.wxs" />
        <Extensions>
            <code_completion />
            <debugger />
            <wxsmith version="1">
                <gui name="wxWidgets" src="EHProxyApp.cpp" main="EHProxyFrame" init_handlers="necessary" language="CPP">
                    <load_resource file="OptionDialog.xrc" />
                </gui>
                <resources>
                    <wxFrame wxs="wxsmith/EHProxyframe.wxs" src="EHProxyMain.cpp" hdr="EHProxyMain.h" name="EHProxyFrame" language="CPP" />
                    <wxDialog wxs="wxsmith/OptionDialog.wxs" src="OptionDialog.cpp" hdr="OptionDialog.h" xrc="OptionDialog.xrc" fwddecl="1" name="OptionDialog" language="CPP" />
                </resources>
            </wxsmith>
        </Extensions>
    </Project>
</CodeBlocks_project_file>

 

4. open the detail compiler and linker cmd..

 

Settings->compiler and debugger->Global compiler settings->other setting->compiler logging->full command line(drop list)

 

5.configure your wxwidget envrionment variable..

 

Settings ->global variables setting->create a new wx, and fullfill the proper directory path...

 

6.compile your project , older gui displaed, oh, yeah!

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值