• (2 Pages)
  • +
  • 1
  • 2

wxWidgets Part I: Getting set up Setting up a development environment: Windows specific, links included Rate Topic: ***** 2 Votes

#1 gabehabe  Icon User is offline

  • GabehabeSwamp
  • member icon




Reputation: 1377
  • View blog
  • Posts: 10,951
  • Joined: 06-February 08

Posted 09 October 2008 - 01:06 PM

Welcome to the wonderful world of wxWidgets! In this series of tutorials, I'm going to be explaining how to develop software in C++ using wxWidgets.

So, what's this wxWidgets stuff?
wxWidgets is a very interesting toolkit, which is compatible with pretty much any operating system! That's right, you can make your software for a whole range of platforms, including:
  • Win32
  • Mac OS X
  • GTK+
  • X11
  • Motif
  • WinCE
  • and more!

It's compatible with a whole bunch of languages, including C++, Perl and C# ~ but in these tutorials, I'll be covering development in C++

What should I already know?
As with all programming concepts, it's important that you've got a good understanding of as many of the key principals as possible. Loops, functions, etc~ oh, and object oriented programming (OOP) is a must!

OK, OK~ let me get started!
It can be quite tedious to set up wxWidgets. Unfortunately, I can only cover the setup for Windows~ sorry everyone else! You can check out the wxWiki, you should be able to find everything you need there. Also, if you have any questions, let me know and I'll do my best to help. :)
So let's get started
Wait... what do we need? Well, a compiler. Obviously. You'll also need to download wxWidgets, and preferably an IDE. (My choice: Code::Blocks)

Where can I get all this stuff from?
First off, get your compiler. MinGW is a great compiler for Windows, and that's what I'll be using. The Microsoft installer is available from here.

As I mentioned earlier, my IDE of choice is Code::Blocks. It's cross platform, but since this tutorial covers Windows, you can get the Windows installer directly from here.

Last but certainly not least, you're going to need the wxWidgets toolkit itself! The Microsoft installer is available here, and for you non-Windows users, check out the downloads page here.

OK, so what now? Install your compiler (MinGW) and wxWidgets. Install them to the root of your drive, so on Windows, you should have:
C:/MinGW
C:/wxWidgets-2.8.9 (or some other version)

Now you're going to need to clean and compile the source code. Fortunately for you Windows user though, I've set up a nice little batch script to do all the work for you. If you want to get it set up automatically, use this batch script.

If you want to do it manually, all you have to do is follow the code in that snippet, typing each command into the command line. (NOT RECOMMENDED!)
(Remember that REM is simply a comment, and not part of the code)

So now it's time to set up Code::Blocks. This bit's pretty easy. Install it (preferably to the default directory in Program Files, but it doesn't matter) and run the exe.

You should now be in front of your new favourite IDE. :)

Go to File>New>Project, and find wxWidgets Project. (It should be right at the bottom)

Follow the instructions until you reach a dialog asking which version you want to use. This should be self explanatory, but (at the time of writing this tutorial) wxWidgets 2.8.x is the latest, so select that.

Next, it will probably ask you to set up wxWidgets. Open the Global Variable Editor, and paste this into the "base" text box:
C:\wxWidgets-2.8.9 (or wherever you installed it to)

Now click close, and continue on through the setup.

You will now be asked to select the setting which match your installation. Check all three boxes (they should be "driver" "monolithic" and "unicode.") If you read the batch script, this will make sense. If not, don't worry about it, it's not important. :)

Continue on through the project setup, and you should eventually have a template prepared for you. This bit's important:
YOU CAN ONLY COMPILE FOR "RELEASE"
This is because we configured wxWidgets for release earlier (again, you'll know if you read the batch script. Don't worry if you didn't)

So, change the Build target to Release, and hit F9 (Compile and run)

That's it! You should now have a window open, built using the example code from the Code::Blocks template!

*Note: I apologise if the end setup (for Code::Blocks) is a little off. I had to do this from memory, since it's only necessary to do it once.

And that's it! It was a long setup, but over the next tutorials in this series, you're going to find out why it was worth it!

Happy coding! :)

***Please feel free to ask any questions regarding this setup. I know it can be tedious, I had problems myself when setting it up. I'll do my best to answer them. :)

Is This A Good Question/Topic? 2
  • +

Replies To: wxWidgets Part I: Getting set up

#2 annamathew  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 21-November 08

Posted 21 November 2008 - 02:10 AM

hi....

im trying to use wxWidgets....

Ive Downloaded wxWidgets 2.8.9.....

now how do i install the libraries and headers????

ive read that.... for wxWidgets 2.6.4.....that ive to
build wx.dsw and wxWindows in all project configurations.....

i cant find wxWindows in latest release 2.8.9...
so will building wx.dsw alone enough
Was This Post Helpful? 0
  • +
  • -

#3 gabehabe  Icon User is offline

  • GabehabeSwamp
  • member icon




Reputation: 1377
  • View blog
  • Posts: 10,951
  • Joined: 06-February 08

Posted 24 November 2008 - 06:52 AM

Are you working with Windows?

If so, try my batch script, it will set them up automatically for you. :)
Was This Post Helpful? 0
  • +
  • -

#4 xtreampb  Icon User is offline

  • D.I.C Regular

Reputation: 14
  • View blog
  • Posts: 337
  • Joined: 20-June 07

Posted 01 August 2009 - 09:31 PM

What if i am wanting to use Microsoft Visual C++ 2008 express. Can you help me with that? I know that this was posted last year.
Was This Post Helpful? 0
  • +
  • -

#5 BetaWar  Icon User is offline

  • #include "soul.h"
  • member icon

Reputation: 1138
  • View blog
  • Posts: 7,105
  • Joined: 07-September 06

Posted 01 August 2009 - 10:40 PM

In short, yes you can still do it. It just takes a little bit of work. Install like you would normally. Then you will need to follow this tutorial:
http://wiki.wxwidget...l_C%2B%2B_Guide
to get everything linked to your project correctly.

You have to create a file in your project before the appropriate menu will be visible (I know from experience).

I suggest downloading the app called "Minimal" if you can (wxcommunity seems to be offline for me...) then you can import the project into VC++ and it should already have all the necessary settings.

Hope that helps.
Was This Post Helpful? 0
  • +
  • -

#6 DoctorFaust  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 12-August 09

Posted 12 August 2009 - 11:56 AM

Why does it say on the WxWidgets Homepage that your build will take up 400 to 800 MB (or even 10 GIG) when doing it with your .bat takes up next to none? Furthermore, how do they expect to create something so insanely large from that number of resources? ^^

Greetz, Boe
Was This Post Helpful? 0
  • +
  • -

#7 xtreampb  Icon User is offline

  • D.I.C Regular

Reputation: 14
  • View blog
  • Posts: 337
  • Joined: 20-June 07

Posted 12 August 2009 - 08:03 PM

I did it and trusts me it is that big. and it does take 2 hours to build the full batch file. I recommend you just build each one individually in the order that they tell you. It is a lot smaller and faster to build. It gets so large due to the fact that all the linker information and logs information need to be saved as well. I watched it build for about 30 min and it was building each one of the solutions for each type of build available. from debug to release dll ect.
Was This Post Helpful? 0
  • +
  • -

#8 jral27  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 15-July 09

Posted 15 August 2009 - 03:38 AM

View Postgabehabe, on 24 Nov, 2008 - 05:52 AM, said:

Are you working with Windows?

If so, try my batch script, it will set them up automatically for you. :)


i'm using wxwidgets-2.8.10, and i tried using your batch script..
it didn't work.. or i coudn't get it to work..

is your batch script only for ver 2.8.9?
or is it ok if i ask how to configure the project settings or something?
Was This Post Helpful? 0
  • +
  • -

#9 Guest_craPkit*


Reputation:

Posted 21 December 2010 - 02:30 AM

Thank you so much for this tutorial, I count the time this has saved me in days.

Just a quick note for Open Source n00bs (like myself):
There is a Code::Blocks installer out there, which already includes the MinGW compiler. If you use this - probably unknowingly - AND install MinGW a second time with its separate installer (which does not alert that MinGW is already present), you probably won't be able to build wxWidgets with the second installation, even using the batch file provided in the main post. Well, compilation worked for me, but the linker (ld.exe) ended with error status 1 (which was even more annoying, since the erroneous build took about two hours).

It took me several hours to even notice the first installation of MinGW within my CodeBlocks folder. Using this one, I was finally able to compile AND link wxWidgets.

Oh and by the way, dual MinGW installations not only limit the compilation process of wxWidgets itself, but also compilation of your projects within Code::Blocks.
Was This Post Helpful? 0

#10 youbob1212  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 16
  • View blog
  • Posts: 130
  • Joined: 31-October 10

Posted 25 January 2011 - 09:53 PM

I can't find the lwxmsw28u file anywhere! Not in my Wx folder, I search high and low.. Where can I find this file?? I only have just that one build error.

I'm using wxWidgets-2.9.1 and MinGw(The lastest version) for as an compiler..

Also I have uses the script, and linked other files into my library.

This post has been edited by youbob1212: 25 January 2011 - 09:59 PM

Was This Post Helpful? 0
  • +
  • -

#11 doveraudio  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 17-March 10

Posted 01 February 2011 - 07:41 PM

i'm trying to follow the tutorial, and i want to use the latest version wxwidgets, but after managing to get the library to build (i think), i cant get the projects to compile. it keeps asking for .a without the u's on them. i'm going to use the "wxpack" 2.8.1 since projects seem to compile so far with that.

any tweaking tips for mingw and WxWidgets svn?
Was This Post Helpful? 0
  • +
  • -

#12 xtreampb  Icon User is offline

  • D.I.C Regular

Reputation: 14
  • View blog
  • Posts: 337
  • Joined: 20-June 07

Posted 02 February 2011 - 03:08 PM

I have a fix for your problem. after some digging in the source code for wx widgets i found the problem and i have the solution that fixed it for me

keep in mind that xyz is the version you are currently running.

file location
c:\wxWidgets-x.y.z\include\msvc\wx\setup.h

on line 35
#define wxSUFFIX
should be
#define wxSUFFIX u
Was This Post Helpful? 1
  • +
  • -

#13 doveraudio  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 17-March 10

Posted 02 February 2011 - 08:15 PM

View Postxtreampb, on 02 February 2011 - 03:08 PM, said:

I have a fix for your problem.

file location
c:\wxWidgets-x.y.z\include\msvc\wx\setup.h

on line 35
#define wxSUFFIX
should behats
#define wxSUFFIX u


That really helps alot. Except i deleted the folders i had tried to build on my hd. I pretty sure before i had set it to build multiple libs and it was then that i had encountered this problem. Right now i'm using the batch file with the default settings and it keeps dying halfway through the scintilla bits, wxBLAHBLAH - object not recognized - memory depleted
i've got 2.74 physical and my paging file is set to 24 gigs. I'm confused.

Should i try compiling again without cleaning?
Should i change the settings and build into separate libraries?

After that how to i use the library detection tool in code::blocks properly?

This post has been edited by doveraudio: 02 February 2011 - 08:21 PM

Was This Post Helpful? 0
  • +
  • -

#14 xtreampb  Icon User is offline

  • D.I.C Regular

Reputation: 14
  • View blog
  • Posts: 337
  • Joined: 20-June 07

Posted 11 February 2011 - 02:46 PM

ok try this.

when you do a batch build clean it first
next go to project the project dependencies and use that to set the build order
the build order should be...
wxScintilla
stc
richtext
propgrid
aui
xrc
xml
qa
html
media
adv
core
net
base
gl
wxexpat
wxtiff
wxjpeg
wxpng
wxzlib
wxregex

as far as code blocks i'm not sure. i'm using the sln located in your wxWidgets dir/build/MSW/the latest sln

if you start getting errors about the lib like what was suggested earlier then use the fix i presented.
Was This Post Helpful? 0
  • +
  • -

#15 xCraftyx  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 11
  • View blog
  • Posts: 258
  • Joined: 13-September 08

Posted 16 March 2011 - 07:16 AM

So I know this is old as hell but I'm just setting up wxWidgets and I've run into a problem. This tutorial is fantastic and saved me a huge amount of time but once I've gone through the entire process, Code::Blocks gives me a warning when i create the project telling me that there is no configured release build in the wxWidgets directory (2.8.11) and my release build will not compile. Any ideas on how I should fix this?
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2