C++ School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a C++ Expert!

Join 300,313 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 2,060 people online right now. Registration is fast and FREE... Join Now!




wxWidgets Part I: Getting set up

 
Reply to this topicStart new topic

> wxWidgets Part I: Getting set up, Setting up a development environment: Windows specific, links included

gabehabe
Group Icon



post 9 Oct, 2008 - 12:06 PM
Post #1


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. smile.gif
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. smile.gif

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. smile.gif

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! smile.gif

***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. smile.gif
Go to the top of the page
+Quote Post


Register to Make This Ad Go Away!

annamathew
*



post 21 Nov, 2008 - 01:10 AM
Post #2
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
Go to the top of the page
+Quote Post

gabehabe
Group Icon



post 24 Nov, 2008 - 05:52 AM
Post #3
Are you working with Windows?

If so, try my batch script, it will set them up automatically for you. smile.gif
Go to the top of the page
+Quote Post

xtreampb
**



post 1 Aug, 2009 - 08:31 PM
Post #4
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.
Go to the top of the page
+Quote Post

BetaWar
Group Icon



post 1 Aug, 2009 - 09:40 PM
Post #5
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.wxwidgets.org/Microsoft_Visual_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.
Go to the top of the page
+Quote Post

DoctorFaust
*



post 12 Aug, 2009 - 10:56 AM
Post #6
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? happy.gif

Greetz, Boe
Go to the top of the page
+Quote Post

xtreampb
**



post 12 Aug, 2009 - 07:03 PM
Post #7
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.
Go to the top of the page
+Quote Post

jral27
*



post 15 Aug, 2009 - 02:38 AM
Post #8
QUOTE(gabehabe @ 24 Nov, 2008 - 05:52 AM) *

Are you working with Windows?

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


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?
Go to the top of the page
+Quote Post


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 


Lo-Fi Version Time is now: 11/7/09 02:19PM

Live C++ Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month