Compiling wxWidgets 2.6.2 to develop Code::Blocks (MSW)

From CodeBlocks
Revision as of 11:50, 9 June 2005 by Mispunt (Talk | contribs)

Jump to: navigation, search

These are the instructions to compile wxWidgets do you can compile Code::Blocks on your own.

NOTE: These instructions are MS Windows (TM) specific, but because we are using MinGW it should be possible to use these instructions with some modifications on other platforms.

Install MinGW

If you don't have the Code::Blocks + MinGW bundle, grab the latest MinGW stuff from the MinGW site and install it under a directory you like. NOTE: In these instroctions we're calling the MinGW directory <MINGW>, so you have to replace that with you're own directory.

If you DO have the Code::Blocks + MinGW bundle, or have already installed MINGW on your own, you can skip this section.

NOTE: The files are compressed in the tar.gz format. You need a third-party extraction utility to unzip them. (like 7-zip)

You need at least the following files:

GDB is not really needed, but could be usefull for debugging.

After you install, make sure you have the following directories under your path:

  • <MINGW>\bin;
  • <MINGW>\mingw32\bin;

Download and Install the wxWidgets source code

The wxWidgets 2.6.1 distribution can be found at the wxWidgets website. (Note that ther e is also a winhelp file available.) You can get choose between an installer and a zip file. You can just get the zip file because the installer is also a zipped version.

If you use the plain zip version, make sure to unzip using the full path. Otherwise the directories won't be created correctly.

NOTE: In the rest of these instructions we are calling the wxWidgets directory <WXWIN> you have to change it to your own directory. (e.g. "c:\wxWidgets-2.6.1")

Check make version

If you didn't install MingW yourself you have to make sure you have the right version of make. Open the command prompt and type:

mingw32-make -v

If the version is 3.80 or greater it is allright to go on, else you have to install the new make.

Building wxWidgets

Now it is time to compile wxWidgets, open the command promt and change to the wxWidgets directory:

cd <WXWIN>\build\msw

Now we are on the right place we are first going to clean up the source:

mingw32-make -f makefile.gcc clean

NOTE: if you still have problems with compiling after cleaning, you may want to remove the directory in the build\msw directory. (it contains object files...) When everything is clean we can compile wxWidgets:

mingw32-make -f makefile.gcc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=0 VENDOR=cb

NOTE: these options are the official Code::Blocks options. When you want another version of wxWidgets (unicode or debug) you have to make sure you build a MONOLITHIC version. (One big dll) Now you can get a cup of coffee, or do something else, because this could take a long time.

Build the STC library

If you closed the command promt, you have to open it again. We are going to the STC directory

cd ..\..\contrib\build\stc

We clean the source:

mingw32-make -f makefile.gcc clean

And we going to compile it. Make sure you have the same build options as before.

mingw32-make -f makefile.gcc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=0 VENDOR=cb

So now everything is compiled for using codeblocks.

Copy libraries

When compilation is finished it is usefull to copy the libs to another directory. By doing this you can make several builds (e.g. debug and release).

  • So first we create a directory this could be done in <WXWIN>\lib.
  • Then we go to the directory <WXWIN>\lib\gcc_dll (could called diffrent when you changed the build options)
  • Now we move all the files (.a .dll) and the directory (msw) to the directory of your choice. (for me it is <WXWIN>\lib\codeblocks)

NOTE: Make sure you everything is removed from the directory <WXWIN>\lib\gcc_dll else you can get trouble when compiling another version.

Setting up paths

Everything is done now, and we can start compiling Code::Blocks, couldn't we? No! First we have to setup the paths. Open the codeblocks project (CodeBlocks-wx2.6.0.cbp) and go to the Build options. From there you have to go to the tab Directories and Compiler. Here you have to add the following paths (Remember to replace <WXWIN>)

  • <WXWIN>\lib\codeblocks\msw
  • <WXWIN>\include
  • <WXWIN>\contrib\include

The first path is used to find the right setup.h for the build you are using. The other two are for the normal include files.

Now go to the Linker tab and add the following path:

  • <WXWIN>\lib\codeblocks

NOTE: You have to replace this with the directory of your own choice in the previous section!

Now you are finished with the configuration and you can hit the compile button (CTRL-F9). Be aware that Code::Blocks is not officially support wxWidgets 2.6.1 so it is possible that new files are not yet in the project. You have to do this by your self.