Ubuntu 8.0.4 wxWidgets compile problem, in Code::Blocks Topic is solved

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
MattPhillips
Knows some wx things
Knows some wx things
Posts: 48
Joined: Mon Jun 16, 2008 1:50 pm

Ubuntu 8.0.4 wxWidgets compile problem, in Code::Blocks

Post by MattPhillips » Fri Aug 08, 2008 3:15 am

Hello,

I'm trying to get the default wxWidgets (wxGTK-2.8.8) program to work in C::B, and I can't get it to compile. First off, wxWidgets is apparently installed correctly as
~/Public/wxGTK-2.8.8$ wx-config --cxxflags --libs
produces
-I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread
-pthread -Wl,-Bsymbolic-functions -lwx_gtk2u_richtext-2.8 -lwx_gtk2u_aui-2.8 -lwx_gtk2u_xrc-2.8 -lwx_gtk2u_qa-2.8 -lwx_gtk2u_html-2.8 -lwx_gtk2u_adv-2.8 -lwx_gtk2u_core-2.8 -lwx_baseu_xml-2.8 -lwx_baseu_net-2.8 -lwx_baseu-2.8
However, when I try to compile with default built options in platforms.h, I get an error at
#include "wx/setup.h"
namely
error: <wx/setup.h> no such file or directory.
On the other hand, if I use the build options specified here
I.e. `wx-config --cppflags` (--libs)

I get an error in assert.h at
#if defined __cplusplus && __GNUC_PREREQ (2,95)
namely,
/usr/include/assert.h|39|error: missing binary operator before token "("|
Finally, if I copy setup.h from the include/wx/msw directory, I get
#error "No Target! You should use wx-config program for compilation flags!"|
This doesn't make any sense to me because I *am* using wx-config in the Debug/Release compiler and linker build options.

What is going on?! I have been at this intermittently for weeks and I have no idea why it should be so hard. I'm also a Ubuntu newbie so that could be part of the problem.

Best,
Matt
Last edited by MattPhillips on Fri Aug 08, 2008 2:48 pm, edited 1 time in total.

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

Post by DavidHart » Fri Aug 08, 2008 10:54 am

Hi Matt,

I don't use c::b, but I'll try anyway...
However, when I try to compile with default built options in platforms.h
That won't work: you have to use wx-config (or its output).
I.e. `wx-config --cppflags`
That should be cxxflags, but it probably doesn't matter here.
Finally, if I copy setup.h from the include/wx/msw directory
That is definitely not a good idea ;)
/usr/include/assert.h|39|error: missing binary operator before token "("|
I haven't seen that one before (though google has, but without giving a cause).

First, do you have the 'build-essential' package installed? If not, maybe one of its components is missing.

If that's not the answer, I suggest you try building a simple C/C++ program that you create by hand. e.g.

Code: Select all

#include "stdio.h"

int main(void)
{
printf("Hello world\n");
}
or

Code: Select all

#include <iostream>
 
int main()
{
    std::cout << "Hello world\n";
}
building them with g++ ./test.cpp -o test

If this works, you know your build system is OK. The next step would be to grab a known-working wx sample e.g. http://svn.wxwidgets.org/viewvc/wx/wxWi ... inimal.cpp and build it in a console with the line
g++ `wx-config --libs --cxxflags` minimal.cpp -o minimal

If this works too, then you have a c::b problem, and the c::b forum is probably your best bet.

Regards,

David

FlyingIsFun1217
Super wx Problem Solver
Super wx Problem Solver
Posts: 497
Joined: Mon Nov 06, 2006 9:58 pm

Post by FlyingIsFun1217 » Fri Aug 08, 2008 1:44 pm

And it'd probably be best to try this on a stable operating system (when you say 9.04 I assume you mean 8.10, the latest 'release').

FlyingIsFun1217

Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post by Auria » Fri Aug 08, 2008 11:24 pm

How did you install wx? I remember hearing about broken wx-dev packages in ubuntu

MattPhillips
Knows some wx things
Knows some wx things
Posts: 48
Joined: Mon Jun 16, 2008 1:50 pm

Post by MattPhillips » Sat Aug 09, 2008 3:27 am

David,

Thank you thank you--I did what you said and that isolated my problem to C::B, where I was able to solve it in about 10min. Now I just have to get wxWidgets to see openGL headers, but hopefully I won't need to use the Forum for that.

Best,
Matt

P.S. Thanks to others for your time and to FF for noticing the typo.

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

Post by DavidHart » Sat Aug 09, 2008 9:39 am

I did what you said and that isolated my problem to C::B, where I was able to solve it in about 10min.
It would be nice if you could post the solution here, in case other people have the problem in the future (if the cause wasn't too embarrassing ;) ).

MattPhillips
Knows some wx things
Knows some wx things
Posts: 48
Joined: Mon Jun 16, 2008 1:50 pm

Post by MattPhillips » Sat Aug 09, 2008 12:38 pm

Sure--

1) I compiled and ran samples from the command line like you said, proving that wxWidgets was built successfully.

2) I went back to the Settings->Compiler and Debugger->Search Directories dialog, where I had earlier entered

/home/matt/Public/wxGTK-2.8.8/include
/home/matt/Public/wxGTK-2.8.8/include/wx

as directories to search through. I deleted them, and suddenly my example wxWidgets programs compiled. I guess *adding* these paths caused C::B to find same-named files as the ones it actually needed in other directories? I don't get it but I sure feel lucky I remembered how to retrace my steps. A good 'newbie lesson'.

BTW I would give you a 'wxAward' but I don't really see how to do that here on the reply page.

Best,
Matt

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

Post by DavidHart » Sat Aug 09, 2008 1:10 pm

BTW I would give you a 'wxAward' but I don't really see how to do that here on the reply page.
It's not important anyway, but you already did: when you "Accepted" my first post.

FlyingIsFun1217
Super wx Problem Solver
Super wx Problem Solver
Posts: 497
Joined: Mon Nov 06, 2006 9:58 pm

Post by FlyingIsFun1217 » Sat Aug 09, 2008 2:26 pm

Glad your problem was sorted out!

FlyingIsFun1217

Post Reply