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
MoonKid
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 543
Joined: Wed Apr 05, 2006 9:39 am
Contact:

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

Post by MoonKid »

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

user@MONSTER:~/share/work/wx-test$ locate libwxbase
/usr/share/doc/libwxbase2.8-0
/usr/share/doc/libwxbase3.0-0
/usr/share/doc/libwxbase2.8-0/README.Debian
/usr/share/doc/libwxbase2.8-0/changelog.Debian.gz
/usr/share/doc/libwxbase2.8-0/copyright
/usr/share/doc/libwxbase3.0-0/README.Debian
/usr/share/doc/libwxbase3.0-0/changelog.Debian.gz
/usr/share/doc/libwxbase3.0-0/copyright
/usr/share/lintian/overrides/libwxbase2.8-0
/usr/share/lintian/overrides/libwxbase3.0-0
/var/lib/dpkg/info/libwxbase2.8-0:i386.list
/var/lib/dpkg/info/libwxbase2.8-0:i386.md5sums
/var/lib/dpkg/info/libwxbase2.8-0:i386.postinst
/var/lib/dpkg/info/libwxbase2.8-0:i386.postrm
/var/lib/dpkg/info/libwxbase2.8-0:i386.shlibs
/var/lib/dpkg/info/libwxbase3.0-0:i386.list
/var/lib/dpkg/info/libwxbase3.0-0:i386.md5sums
/var/lib/dpkg/info/libwxbase3.0-0:i386.postinst
/var/lib/dpkg/info/libwxbase3.0-0:i386.postrm
/var/lib/dpkg/info/libwxbase3.0-0:i386.shlibs
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?
DavidHart
Site Admin
Site Admin
Posts: 4252
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 »

Hi,

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)

Regards,

David
Post Reply