wxWidgets Gui Development On Windows Using Netbeans (and compiling wxWidgets using TDM-GCC)

As for the previous post(wxWidgets Gui Development On Windows) (Do not follow previous tutorial before this) targets the simplest approach now I’m going to explain a harder approach. Netbeans is one of my favorite development environments, its easy to use however its not lightweight. But it is recommended for larger projects. https://netbeans.org/downloads/ 

image

There are two downloads which we can use. I suggest the complete package.

(Note: Netbeans ‘All’ download needs JDK)

Downloading JDK  (Optional)

http://www.oracle.com/technetwork/java/javase/downloads/index.html

image

Click the Java Platform (JDK) #u## not JDK # + Netbeans

Now uninstall all components from wxWidgets Gui Development On Windows tutorial this is a separate tutorial and those previous installations may cause problems.

Now install Netbeans (and JDK if needed).

Next thing you need is TDM-GCC http://tdm-gcc.tdragon.net/download

image

get the tdm-gcc-webdl and install it

image

Now we need to download and install wxWidgets  http://wxwidgets.org/downloads/

image

Install it to default installation directory.

Now we need to add some environment variables

guide (Windows XP) http://www.computerhope.com/issues/ch000549.htm

guide (Windows 7) http://www.itechtalk.com/thread3595.html

guide (Windows 8) http://java-buddy.blogspot.com/2012/01/set-path-for-jdk-7-on-windows-8.html

these guides provide sample of how you can add an environment variables.

image

now set the user Path to C:\Mingw32\bin

image

open a command prompt and type g++ if you get above result its working

now type cd C:\wxWidgets-2.9.5\build\msw and press enter.

now use command mingw32-make -f makefile.gcc BUILD=release UNICODE=1 SHARED=0 MONOLITHIC=1 and press enter.

this is going to take a lot of time so go take a nap.

(I also recommend disabling antivirus)

Now we need to download 7zip http://www.7-zip.org/download.html

(7zip is optional if and only if you have 7zip installed.)

now we need to download prebuilt MSYS get it from http://nuwen.net/mingw.html

search for the msys 7zip file using your browsers built-in search

image

extract the msys-10.4.7z and you will get:

image

now goto 7zip installation directory (probably C:\Program Files\7-Zip or C:\Program Files (x86)\7-Zip)

and copy the 7z.exe and paste it where extract.bat is located (msys extracted dir)

and run extract.bat by double clicking it. now delete 7z.exe and extract.bat and you will get:

image

keep this folder opened for now and go to environment variables and add

WXCFG = gcc_lib\mswu

WXWIN = C:\wxWidgets-2.9.5

image

now we need to download wx-config.exe https://sites.google.com/site/wxconfig/

click the download there and get it. and copy it to C:\Mingw32\bin

now go to the folder where extracted msys is at and select all files and folders there and copy
them.

now go to C:\Mingw32\ and paste (replace all the folders).

also copy and paste wx-config.exe to C:\Mingw32\bin

go to C:\Mingw32\bin and do the following

image

fire up Netbeans and go to tools –> options –> C/C++

click Add button and put following details

image

now

image

then creating the project

image

now we need to configure the project

Right click project and go to properties

image

do the configuration as illustrated above (under C++ Compiler option)

copy and paste `wc-config –cxxflags`

(it is backquote)

now go to linker option

image

apply settings as above illustrated.

copy and paste

-mthreads -lwxmsw29u -lwxtiff -lwxjpeg -lwxpng -lwxzlib -lwxregexu -lwxexpat -lkernel32 -luser32 -lwxregexu -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 –lwsock32

Please note that above code is a single line

(Why not `wx-config –libs` ? the wx-config always assumes that the build is debug)

you can input same data to both debug and release configurations. for now use the release configuration.

now get this code https://gist.github.com/JaDogg/6197941 and paste it to main.cpp

now build project and run project (see run menu).

References

http://wiki.wxwidgets.org/Compiling_using_Netbeans

http://wiki.wxwidgets.org/Compiling_wxWidgets_with_MinGW

http://www.wxwidgets.org/docs/tutorials/hello.htm

http://stackoverflow.com/questions/3864593/setting-up-netbeans-to-compile-wxwidgets-projects-under-windows

5 thoughts on “wxWidgets Gui Development On Windows Using Netbeans (and compiling wxWidgets using TDM-GCC)

  1. must be
    `wx-config cxxflags`
    and
    -mthreads -lwxmsw29u -lwxtiff -lwxjpeg -lwxpng -lwxzlib -lwxregexu -lwxexpat -lkernel32 -luser32 -lwxregexu -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 lwsock32

  2. I usually do not drop many responses, but i did
    a few searching and wound up here wxWidgets Gui Development
    On Windows Using Netbeans (and compiling wxWidgets using TDM-GCC)
    | Bhathiya -JaDogg- Perera’s Blog. And I do have a couple of questions for you if it’s allright.
    Could it be simply me or does it look like a few of these comments appear like left by brain dead
    folks? 😛 And, if you are writing at additional social sites, I
    would like to follow everything fresh you have to post. Would you list
    of all of all your communal pages like your linkedin profile, Facebook page or twitter feed?

  3. I am very happy to find your site! I am familiar with NetBeans already and need to learn wxWidgets for work. It is clear you did a tremendous amount of work to write out step by step how we need to set up NetBeans to run wxWidgets. I am very grateful to you!

    But I am having some problems that I don’t know how to fix. Can you please help me?

    I followed most of your directions on this site, to try to get a simple “Hello world” program to run in NetBeans and wxWidgets. I say “most of” because the installation for wxWidgets doesn’t exactly match the steps above.

    For example: in the section for NetBeans’s Code assistance, it says to add folder c:\wxWidgets-2.9.5\lib\gcc_lib\mswu to the list of include directories. Well, new version number aside, there is no folder wxWidgets-x\lib\gcc_lib\mswu. There’s only one folder under lib, and it’s called “watcom.” I don’t know what is supposed to be inside \gcc_lib\mswu, so I don’t know where I should be telling the compiler to look for those files.

    Maybe it’s because of that, or maybe there’s some other reason, but my copy of the program does not compile. Here is the first error:

    On the line

    public wxApp

    I get the error “Unable to resolve identifier wxApp.” I get similar errors for the following lines:

    public wxFrame [“Unable to resolve identifier wxFrame.”]

    MyFrame(const wxString &title, const wxPoint &pos, const wxSize &size); [“Unable to resolve identifier” wxString, wxPoint, and wxSize]

    and lots more errors down below.

    I know the C language, but I am just learning C++. I don’t know how to fix these errors. Can you give me any suggestions?

    Thanks!

    Colleen

Leave a Reply

Your email address will not be published. Required fields are marked *