Long I don’t write back in this site, and now I will write how to install wxwidgets. Why wxwidgets and not using like gtk/gtkmm/qt?
I choose wxwidgets because wxwidgets supports OOP concepts and cross platform gui application using c++ and wxwidgets in easy to compile on windows not like gtkmm, I always error for compiling newest gtkmm/gtk. And why not qt? I think qt is best cross platform gui too, but you must buy a license if you want using for commercial application.
Okay now first how to install wxwidgets on your Linux (example I using ubuntu 14.04). So to install wxwidgets, just open your terminal and write this code:
$ sudo apt-get install libwxgtk3.0-0 libwxgtk3.0-dev
And this is why I very like linux and open source? Because in Linux and now example ubuntu, to install more applications open source, we not must compile before, we just only install binary/dependencies from repository. Not like Windows, we have to compile the previous.
So if you are using windows, you must download mingw tools, mingw is compilers. Okay for mingw I using TDM-GCC because TDM-GCC is from default support wxwidget, you can see on their website in here http://tdm-gcc.tdragon.net/.
Okay for windows user, first you must need is:
- Download c++ compilers from here http://tdm-gcc.tdragon.net/download
- Download wxwidgets installer from here https://www.wxwidgets.org/downloads/. And choose Windows installers
- If right, the file look like this:
Installation wxwidgets on windows
Then now how to install wxwidgets on windows, you can follow this instruction:
- First install your TDM-GCC and install on C: directory like this
- And do the same thing on wxWidget installer
- And now make sure you have add tdm-gcc bin directory to environment variables (google it if you don’t know and how to add environment variables)
- Now open your command prompt and check if your mingw is can be used with this code:
And you can get result like this:
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
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
- Then for compiling wxwidgets I follow instruction from here http://wiki.wxwidgets.org/Compiling_wxWidgets_with_MinGW. So from your command prompt, we must change active directory to wx folder:
And now the first we must clean wxwidget source using this command:
C:\wx\build\msw>mingw32-make -f makefile.gcc SHARED=1 UNICODE=1 BUILD=release clean
If clean source finish, then you must compile the source using this command:
C:\wx\build\msw>mingw32-make -f makefile.gcc SHARED=1 UNICODE=1 BUILD=release
- If right and you not get an error, you can have gcc_mswudll folder like this:
Update if you’re using visual studio 2013
If you’re install visual studio, you can’t install TDM-GCC compiler, because we can use windows c++ compiler. So after your visual studio installed, open windows explorer and go to C:\wx\build\msw and open file wx_vc12.sln and wait visual studio load this file until finish.
After that make sure the solution configurations is Debug mode if you want create static library or if you want create shared library you can use DLL debug/DLL Release:
What is the different of static and shared libraries?
And this is simple answer from me:
With static library, you can build/compile your applications to one file executable. But if you use with shared library, your applications need/must include .dll file
Look at this picture, I create application with static library and shared library.
This file is using shared library:
This file is using static library:
And for more info about static and shared library, read from this site http://stackoverflow.com or you can google it.
Okay then after you choose wat you want (static or shared), now right click the project from solutions explorer and select Build Solution or you can use key shortcut CTRL + SHIFT + B.
Wait until finish and not showing the error. If the compile is successfully you can see directory vc_lib in C:\wx\lib for if you’re compile using debug mode (static library) and vc_dll if you’re compile using DLL debug/DLL release mode.
And now we must create sample applications. Example for development editor I use codeblock. And for the next tutorial to create sample applications follow from this page https://imron02.wordpress.com/2014/08/21/example-c-gui-application-using-wxwidgets/