Author Topic: Setting up code blocks so that I can compile wxwidgets programs.  (Read 36770 times)

djsbriscoe

  • Guest
Hi,
I am a first time user of code blocks and I'm experimenting with C++ and wxwidgets under Windows 2000.
First of all appologies if this is covered somewhere in the forum.
I can not find an up to date step by step guide to setting up code blocks so that I can compile wxwidgets programs.
I followed the instructions at http://forums.codeblocks.org/index.php?topic=1701.0 up to entering the mingw32-make commands.
My path for mingw32-make is c:\progra~1\codeblocks\bin and this is also in my system path. My path for wxwidgets is c:\wxwidgets-2.6.2.
I am using RC2 and I dont understand the note in the above webpage about using a post RC2 build.

Can anyone help me out of this confusion?

Thanks.

David.

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Setting up code blocks so that I can compile wxwidgets programs.
« Reply #1 on: April 11, 2006, 12:40:54 pm »
Hi,
I am a first time user of code blocks and I'm experimenting with C++ and wxwidgets under Windows 2000.
First of all appologies if this is covered somewhere in the forum.
I can not find an up to date step by step guide to setting up code blocks so that I can compile wxwidgets programs.
I followed the instructions at http://forums.codeblocks.org/index.php?topic=1701.0 up to entering the mingw32-make commands.
My path for mingw32-make is c:\progra~1\codeblocks\bin and this is also in my system path. My path for wxwidgets is c:\wxwidgets-2.6.2.
I am using RC2 and I dont understand the note in the above webpage about using a post RC2 build.

Can anyone help me out of this confusion?

Hello,

The problem is that you cannot use RC2 to build C::B from the SVN sources. To build C::B from the SVN sources you should download a nightly build (possibly the latest :)). Anyway, I would advice you to use the latest nightly build as RC2 is a bit old now :).

Happy coding :).

Best wishes,
Michael

djsbriscoe

  • Guest
Re: Setting up code blocks so that I can compile wxwidgets programs.
« Reply #2 on: April 11, 2006, 01:01:02 pm »
Hi,
I've downloaded the latest (10/4/06) build, how do I use it?
Do I have to unzip the files into an existing installation?
Are there any more files I have to download and install?

David.

webwraith

  • Guest
Re: Setting up code blocks so that I can compile wxwidgets programs.
« Reply #3 on: April 11, 2006, 01:04:38 pm »
Apparently you can't install a nightly build over v1.0rc2, so either uninstall it, and unzip to the same folder, or install to a new folder

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Setting up code blocks so that I can compile wxwidgets programs.
« Reply #4 on: April 11, 2006, 01:11:43 pm »
Do I have to unzip the files into an existing installation?

No, please. Do not unzip a nightly build into an existing RC2 installation. Choose another repository.

If you plan to use MinGW and you do not have it yet, then get it (use MinGW 5.0.2 installer). You might want to update later the win32api & binutils files.

From each nightly build post you can download the necessary dll, if you do not have yet.

Are there any more files I have to download and install?

That depends on what you have already (see above). If you have nothing, then the best would be to:

-1: Download and install MinGW
-2: Download gdb 6.3.2 from MinGW website and install it.
-3: Download C::B nightly build
-4: Download the unicode windows wxWidget dll for Code::Blocks
-5: Unzip C::B and the wxWidget dll for Code::Blocks
-6: Start C::B and configure GNU GCC compiler
-7: Download wxWidgets and build it (see http://forums.codeblocks.org/index.php?topic=1701.0)
-8: Enjoy :)

Best wishes,
Michael
« Last Edit: April 11, 2006, 01:14:15 pm by Michael »

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Setting up code blocks so that I can compile wxwidgets programs.
« Reply #5 on: April 11, 2006, 01:15:10 pm »
It looks like there was a misunderstanding, as you said you intended to set up Code::Blocks to compile with wxWidgets, not compile Code::Blocks itself. But you may nevertheless want to use the nightly build, even more so as you have already downloaded it.

Webwraith is right, you should not install a nightly build over RC2. Make sure you have the 7z files for both the nightly build and required libraries.
You can not copy the ones from RC2, as the libraries in the nightly builds are built in a different, incompatible way.

Unpack everything to the same (empty) directory and you're done.


EDIT:
If you want to use the MinGW compiler (most people do, but you can use a different compiler as well), here is a list of everything you need to download:
http://wiki.codeblocks.org/index.php?title=MinGW_installation#gcc_3.4.4_manual_install

It looks more intimidating than it really is. Just download everything you want and unzip inside an arbitrary location (just make sure you use the same location for everything).
« Last Edit: April 11, 2006, 01:18:13 pm by thomas »
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

djsbriscoe

  • Guest
Re: Setting up code blocks so that I can compile wxwidgets programs.
« Reply #6 on: April 11, 2006, 01:27:56 pm »
Hi,
I do not want to build code blocks itself just example wxwidgets programs.
This is what I've done so far.
1/ Uninstalled code blocks RC2.
2/ Downloaded the latest build (10-4-06) CB_20060410_rev2334_win32.7z
3/ Downloded wxmsw26u_gcc_cb.7z
Do I just unzip these into a directory called c:\codeblocks?
Is that all I need? How do I configure GCC?
Sorry for all the questions it just seems a bit confusing at the moment.

Thanks,

David.

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Setting up code blocks so that I can compile wxwidgets programs.
« Reply #7 on: April 11, 2006, 01:34:32 pm »
Hi,
I do not want to build code blocks itself just example wxwidgets programs.
This is what I've done so far.
1/ Uninstalled code blocks RC2.
2/ Downloaded the latest build (10-4-06) CB_20060410_rev2334_win32.7z
3/ Downloded wxmsw26u_gcc_cb.7z
Do I just unzip these into a directory called c:\codeblocks?
Is that all I need? How do I configure GCC?
Sorry for all the questions it just seems a bit confusing at the moment.

You can unzip C::B where do you want (just not on an existing RC2 installation :)).

By configuring GCC, once you have started C::B, go in Settings-->Compiler and debugger, select GNU GCC Compiler and check that the pathes are set correctly.

Best wishes,
Michael

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Setting up code blocks so that I can compile wxwidgets programs.
« Reply #8 on: April 11, 2006, 02:00:05 pm »
Quote
2/ Downloaded the latest build (10-4-06) CB_20060410_rev2334_win32.7z
3/ Downloded wxmsw26u_gcc_cb.7z
Do I just unzip these into a directory called c:\codeblocks?
Is that all I need? How do I configure GCC?
Yes, except for one more thing. You also need the mingwm10.7z archive (http://prdownload.berlios.de/codeblocks/mingwm10.7z).

Put everything into C:\codeblocks (or any other location) and do a "extract here" on all of them.

To install MinGW, get all the files you need (see above, most people need just the base C/C++ and the debugger packages, but I don't know about you of course, you might want Ada or Java too), and do the same thing (put all into one directory and "unpack here").
If you choose a "typical" location like C:\mingw, then chances are good that Code::Blocks will auto-detect everything without you having to do anything at all.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Setting up code blocks so that I can compile wxwidgets programs.
« Reply #9 on: April 11, 2006, 02:12:20 pm »
Oh, wait a moment... we never adressed the original question   :oops:

After you have done the above, you need to get a working installation of wxWidgets from somewhere.

1. There is a DevPak, but I don't know anything about this (I never use DevPaks). It will probably just do fine, though.

2. The "pristine" way of getting wxWidgets is to download the source and compile it.
One way of doing this is by following the instructions on the page that you have already seen. Although that page actually deals with compiling Code::Blocks, the section "Building wxWidgets" does deliver a fully functional monolithic shared build, which is just fine. You can simply copy the commandline and paste it to a DOS window, hit enter, and go away for 15 minutes :)

You have about 200 options during the wxWidgets build process, but only three are really important:
  • SHARED=0 or SHARED=1  -- do you want a DLL (shared) or just static libs?
  • MONOLITHIC=0 or MONOLITHIC=1  -- do you one huge thing or several smaller ones?
  • UNICODE=0 or UNICODE=1  -- do you want Unicode or not?

The templates coming with Code::Blocks assume a monolithic shared build. That does not mean you cannot do otherwise, but SHARED=1 MONOLITHIC=1 involves the least amount of trouble for starters :)
Unicode or not is a personal choice, I recommend enabling it because it is not terribly expensive and you don't have to think about the problem at a later time when maybe someone complains that your applicatons don't work properly in Russian and Chinese...
If you first start in non-Unicode and have to migrate later, I can promise it will be a pain.


The first time you try to compile a wxWidgets project, you will be asked to set the wx global variable. Point that to where you have wxWidgets, this will set all include and library paths correctly (if you ever move your wxWidgets folder to somewhere else, you just change that variable).
« Last Edit: April 11, 2006, 02:14:11 pm by thomas »
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline tsm

  • Single posting newcomer
  • *
  • Posts: 7
Re: Setting up code blocks so that I can compile wxwidgets programs.
« Reply #10 on: April 11, 2006, 03:29:13 pm »
If I'm using SHARED=1 MONOLITHIC=1, is the whole lib linked against my program or just the parts I'm using?

djsbriscoe

  • Guest
Re: Setting up code blocks so that I can compile wxwidgets programs.
« Reply #11 on: April 11, 2006, 04:12:08 pm »
Hi,
Here's what Iv'e done so far (it may help others to follow my steps).

a/ Downloaded and unzipped the following files to c:\program files\codeblocks (noticed there is no bin directory)

1/ CB_20060410_REV2334_WIN32.7Z
2/ WXMSW26U_GCC_CB.7Z
3/ MINGWM10.7Z

Codeblocks starts and auto detects visual c++ toolkit 2003 that is already installed.

b/ Downloaded and installed to c:\mingw all mingw gcc 3.4.4 files and gdb debugger. Restarted computer.
    Wrote a simple helloworld console program and compiled it with gcc. No errors.

If I want to install up to date builds of codeblocks do I just install over the current setup or do I have to do the same al over again?

My next step is the wxwidget setup. I will post an update with my experiences and progress.

Thank you to everyone who has patiently read my posts and answered my questions.

David :D


Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Setting up code blocks so that I can compile wxwidgets programs.
« Reply #12 on: April 11, 2006, 04:30:17 pm »
If I'm using SHARED=1 MONOLITHIC=1, is the whole lib linked against my program or just the parts I'm using?
The whole lib. Shared, monolithic is not perfect in every respect, but it is the least troublesome to start with.

If you only want to only link with the parts that you actually use, you have to either use SHARED=0 MONOLITHIC=0 (and link with the libraries that contain the parts you use) or SHARED=1 MONOLITHIC=0 which is even more troublesome (since you need  to distribute several smaller DLLs with your program).
Or, you could try SHARED=0 MONOLITHIC=1 and hope that the linker does a good job at deadstripping unused code (you'll be disappointed by the MinGW linker, though). In that case, you only need to link against one library, and at least in theory it should only include what you use, too.

The good thing about SHARED=1 MONOLITHIC=1 is that you have a lot less housekeeping and a lot less to remember. You link to one thing, and it just works, and that's it.
Nothing to remember, every monkey could do it. To me, this is a huge advantage, since I prefer spending my time on other things than on wondering why the build fails and what libraries I need to link with. :)
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Setting up code blocks so that I can compile wxwidgets programs.
« Reply #13 on: April 11, 2006, 05:11:08 pm »
If I want to install up to date builds of codeblocks do I just install over the current setup or do I have to do the same al over again?

IIRC you can install a newer nightly build over an older nightly build (if no big changes occur in the newer one). Anyway, I will not do so and chose another repository. For example, if you have C::B installed in C:\Programme\CodeBlocks, I would re-name CodeBlocks repository as e.g., CodeBlocks_old, then unzip the newer nightly build into a new repository CodeBlocks. After testing it, I will delete CodeBlocks_old.

Best wishes,
Michael

Offline tsm

  • Single posting newcomer
  • *
  • Posts: 7
Re: Setting up code blocks so that I can compile wxwidgets programs.
« Reply #14 on: April 11, 2006, 05:14:47 pm »
Or, you could try SHARED=0 MONOLITHIC=1 and hope that the linker does a good job at deadstripping unused code (you'll be disappointed by the MinGW linker, though). In that case, you only need to link against one library, and at least in theory it should only include what you use, too.

Made a mistake. That was the build option I was interested in. Thanks for the answer.