tutorials or guides to install

Hi,

I'm looking for a step by step, fool-proof guide or tutorial on how to get through the daunting task of installing wxWidgets and compiling with wxWidgets, with the codeblocks and Mingw bundle.

Its a headache for anyone who is tackling it for the first time. I unsuccessfully tried to compile wxWidgets many times until I eventually just installed wxPack which later seems to not work.

I overloaded with information from different forums and guides, which don't really explain the differing reasons for differing approaches, all of which hit the wall because they assume certain information to be over-understood.

Wrong linker, wrong compiler, wrong version, wrong forum ( C::B, wxWidgets or Mingw forums ). Completely at a loss.

Operating system? Win7u 64bit.
C::B installed and working.
WxPack installed successfully.
Edited this:
void PlainFrame::OnClose(wxCloseEvent& event)
{
Close();
}
and I am assured the most basic of programs will compile.-it doesn't
I read somewhere that the compiler of the original wxPack should be the same as the compiler I am using to compile in C::B (which is mingw). Too much for a beginner. Too complicated.

Probably just a small problem but without the correct information it is a needle in a haystack.

Thanks in advance.
You're having issues with wxPack due to what you mentioned above earlier. It's built with an older version of MinGW known as version Gcc4.3.2-sjlj. This is a fairly old version of MinGW. I suggest, as I have already done, to remove wxPack. While it's nice if you have the compiler (you don't really need to do anything), it's about worthless if you don't have it.

I believe I was the one who suggested wxPack to you, sorry. Anyways, it's not really a small problem, because now you need to compile wxWidgets from source. Here is a link that provides information http://wiki.codeblocks.org/index.php?title=WxWindowsQuickRef

To give you a general overview, you need to compile wxWidgets (this may take some time, over 4 hours on my slow machine, usually 30-60 minutes on a faster machine). Make sure you remember which flags you use, monolithic, shared, release, etc., as these are important when setting up wxSmith projects. Once compiled, remember what directory your wxWidgets is in and start a new wxWidgets project. You can follow specific steps on setting that project up here: http://wiki.codeblocks.org/index.php?title=WxSmith_tutorial:_Hello_world

Note: The information about what options to use with wxSmith is either old or for another OS, I'm not sure. But this is the place that you'll enter the flags you used to compile. If UNICODE=1 you want Use Unicode, if SHARED=1, you want use wxWidgets.dll, if MONLITHIC=1, you want a monolithic library.

Note: When you compile, you might get some errors about strcasecmp or some other strcmp function. Doing some google searches will help alleviate this issue, but it seems to be directly related to the std-c++ flag passed.
Not at all. No need to apologize. You actually pushed me in the right direction and no matter what advice you could have given me there is always a learning curve and the subsequent headache involved.

I'm very happy to have found codeblocks, so thankyou for that. I'm not sure if the mingw compiler is the one I need to freely distribute the code because of the various licences involved but it seems it might be.

Wxwidgets is cross platform, exactly what I wanted. Thanks for that also.

When I read you answer to my other post I went about researching C::B and I actually started with wxWidgets not wxPack!

I had problems with versions 2.8.12 and went for version 2.8.6 but both failed to compile with the crash of ld.exe.

The lengthy process which you mentioned ( 4h ) gets a bit daunting if it fails. After a few unsuccessful attempts I re-read your post and went to wxPack which installed without any problems at all.

Of course it doesn't function with mingw.

I was also unsure about the different options: Monolythic, unicode, shared, etc. Since I don't know what they are for. Monolythic , I know, creates a large DLL but I don't know the logic behind it is nor for the other options.

Anyway, I don't give up easily. I'm from the 'read the damn manual' days when forums were scarce and not many people dared to dabble in programming or Linux. I got through that so I can get through anything.
A quick overview of the links I posted (I hate following links since they're explained in a lot of detail and I have a short attention span) is as follows:

Build wxWidgets
Assuming you have the latest version of C::B (12.11) and the MinGW that comes with it (4.7.1 I believe) you need to build wxWidgets as follows:

Go to the command prompt and make sure that the MinGW directory is part of the path. Type mingw32-make -v. You should get an output other than mingw32-make doesn't name a program or something like that. Mine displays:
C:\Documents and Settings\Administrator>mingw32-make -v
GNU Make 3.82.90
Built for i686-pc-mingw32
Copyright (C) 1988-2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Note: I have a different version of MinGW installed though.

As long as you get something along those lines, we can build wxWidgets. Change the working directory to the one that has the main directory of wxWidgets. Mine is C:\wxWidgets-2.9.4.

This step is pretty simple, but long, as you already found out. I used this command to build my version mingw32-make -f makefile.gcc MONOLITHIC=1 SHARED=0 UNICODE=1 BUILD=release.

Now, I'll explain in a little bit more detail what each of those do and their counterparts.
Monolithic specifies one large DLL or several small ones. This also determines the necessary libraries that need to be included into wxWidgets when compiling a project (one large library or a few smaller ones). If this is set to 0, monolithic is turned off and you must include each library that you're going to use. This saves space in the long run, but if you're just starting out, it's one more headache to worry yourself with. This also prevents (if shared is turned on) having to include several different DLLs. MONOLITHIC=1 is suggested.

Shared specifies if you're going to be creating a smaller .exe but requiring a DLL (or multiple) of if you're going to generate one large executable that only requires DLLs that are needed to run any other built application (I believe there is one or two required for mingw built programs). SHARED=0 disables the need for DLLs (you're more than welcome to include them anyways, but not needed) but makes your program larger. SHARED=1 requires the DLLs (as stated above) and is recommended (not by me). This will create a smaller .exe

Unicode specifies if you want to enable unicode characters or not. Since Unicode has been accepted as a standard, it's been included in almost every OS in the last 10-15 years. UNICODE=1 enables unicode and is highly recommended. UNICODE=0 disables unicode, I don't recommend it, and requires a little more work when working with special characters.

Build specifies your target application. For all intensive purposes, you only need release. debug allows wxWidgets to enter it's own debugging symbols. You can make two different builds if you really want to use a debugger, but you can set up a debug version of your program to just use the gdb debugging symbols.

Once your wxWidgets is built, it's on to test it.

Creating a wxSmith Project
Obviously you're going to want to open up C::B and create a new project (even though you have one, I suggest making a new one in case any of the flags were changed). Select wxWidgets at the bottom. If you get a welcome screen, skip it. Choose your version (the version of wxWidgets you built (mine was 2.9.4, yours might vary)). Select project title, directory, etc. Enter your information if you want. Select wxSmith and Frame based. Select the directory that wxWidgets is located in (mine was C:\wxWidgets-2.9.4). Select compiler and uncheck debug or you're going to get an error in the next step. This is where the flags are important.
Use wxWidgets DLL = SHARED. If shared was 1, select this.
wxWidgets is built as a monolithic library = MONOLITHIC. If monolithic was 1, select this.
Enable unicode = UNICODE. If unicode was 1, select this.

Create Empty Project I leave this unselected as it creates your starting frame and a lot of other stuff you don't want to worry about yet.
Create and use precompiled header (PCH) I highly suggest using this as there are a lot of header files and they're fairly large. Enabling this will take longer to compile on the first time than if it was off, but all sequential builds (that don't modify the headers) will compile quicker than if it was off.
Configure Advanced Options I suggest leaving this off as the default options are fine for a base user.

You're done. Now compile and run it. If you followed the steps I gave you, everything should be fine with the possible exceptions of an error indicating _strdup and strcasecmp haven't been defined. The only workaround that I know of is to disable all C++ flags (C++0x, C++11, etc.) and enable this flag -std=gnu++0x. You can add this line under the build options of the project under other options of compiler settings.

Let me know how it goes and if you run into any errors, try to copy the build log's initial command to compile (it will be rather long and be filled with a bunch of information). If you're getting errors, paste them too.

If everything works, have fun. ^.^
Last edited on
Firstly, thank you for taking the time to write such a lengthy and detailed post.

Here is what I have done, almost exactly the same as yourself except for a few minor details.

Before we begin,
a few obsevations:

C::B v12.11

C:\Users\******>mingw32-make -v
GNU Make 3.82
Built for i386-pc-mingw32
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.o
This is free software: you are free to change and redist
There is NO WARRANTY, to the extent permitted by law.

Directories: (short paths)
C:\Codeblocks
C:\Codeblocks\mingw
C:\Codeblocks\wxwidgets2.9.4

Here is what happened:

I downloaded from the wxwidgets website the wxall version 2.9.4.
Path set to Mingw\bin
build as follows: mingw32-make -f makefile.gcc MONOLITHIC=1 SHARED=0 UNICODE=1 BUILD=release.

Build worked flawlessly. (at least I didn't pick up any errors like the other times)

Open codeblocks-->new project-->etc,etc-->(all options as per your post)

A matching debug configuration cannot be found in the wxWidgets directory.

Note the version of mingw and also note we did not clean before building wxWidgets.

Volatile Pulse wrote:
Select the directory that wxWidgets is located in (mine was C:\wxWidgets-2.9.4). Select compiler and uncheck debug or you're going to get an error in the next step. This is where the flags are important.
GoldenBoy wrote:
A matching debug configuration cannot be found in the wxWidgets directory.

That's the error you get ;)

Technically, it's a minor error since I believe you can keep going. It's just saying that it can't information about wxWidgets to set up a debug version. Like I said, you can build a second version of wxWidgets to target debug if you really need, or you can just make your own debug version in C::B. I don't use debug much (with the exception of testing for memory leaks) so I'm content with just a release version. If you absolutely need the debug version, I can help you through that step, but I've never dual-built (debug AND release) wxWidgets.
Ok, my bad, lets skip passed that.

To check that wxwidgets actually compiles I added:

void newFrame::OnClose(wxCloseEvent& event)
{
    close();
}


To the new project.

I am pretty sure that that is all that is needed to compile the most simple of programs (just a window that opens and closes.)

Here is the error:

C:\CodeBlocks\wxWidgets2.9.4\include\wx\platform.h|154|fatal error: wx/setup.h: No such file or directory|

Make sure your target specifies Release and not Debug. This can be found on the compiler tool bar as "Target". You can also find it by going to: Build -> Select Target -> Release.
Last edited on
Done that thanks.

Also remembered that once upon a time I was playing with the Global Comiler settings. I just changed the first 4 back to:

mingw32-g++.exe

The basic program compiled as expected but crashes on exit.

The crashing is hard thing to resolve. Try removing that definition (OnClose) and see if you still experience the crash. Also, if you run into anymore issues, PM me. I'll see if I can help you out on a more personal basis (this might require viewing your settings for the compiler and walking you through step by step in case something got changed).
Last edited on
Thanks for all the help I will be sure to PM and I hope other people find this thread useful in the future.
Topic archived. No new replies allowed.