How to build a simple wx-application with gcc on Ubuntu?

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 543
Joined: Wed Apr 05, 2006 9:39 am

How to build a simple wx-application with gcc on Ubuntu?

Post by MoonKid » Sun Nov 01, 2015 9:14 pm

I used wxWidgets years ago on a Windows system with MSVC and CodeBlocks as IDE.
Currently I am indirect using wxWidgets with its Python binding wxPhoenix (the dev-version wxPython) on Ubuntu 14.04.03.

To analyse a maybe-bug I need to build a simple wx-app in C++ on my system. I don't want to setup a C++-IDE for that. I want to use gcc on the shell.

But before I ask how to do that with gcc, I want to check if wxWidgets is still in my system.
I don't know where to look for the headers and lib files. Because I build wxPython myself I think there is a wxWidgets somewhere in my system because the wxPython-build interanly download and build wxWidgets. But I don't know details about it.

I found a /usr/include/wx-3.0/wx/wx.h on my system. And I found this about libwxbase.

Code: Select all

[email protected]:~/share/work/wx-test$ locate libwxbase
Because of the testing I need to use the same wxWidgets that is used by my self-build wxPython. I don't want to download any install-tarballs/debs. Where should I find libs and headers for wx that a gcc can find them?

Site Admin
Site Admin
Posts: 3991
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: How to build a simple wx-application with gcc on Ubuntu?

Post by DavidHart » Sun Nov 01, 2015 11:06 pm


Start at the beginning. Do, in a terminal:
wx-config --list

and, if appropriate:
wx-config --version

If you get unhelpful answers, it suggests that there isn't a usable wx installation.

If you do find a useful installation, then you can use it to build with g++, doing things like:
g++ foo.cpp bar.cpp `wx-config --cxxflags --libs` -o binaryname

Note that the wx-config call must be after the cpp file(s)



Post Reply