How to create a new wxWidgets project on Snow Leopard?

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
blizzymadden
Experienced Solver
Experienced Solver
Posts: 50
Joined: Sun Dec 05, 2004 2:44 am

How to create a new wxWidgets project on Snow Leopard?

Post by blizzymadden »

The Wiki says to start from a new Carbon project when creating a WX project. The problem is, XCode 3.2 (Snow Leopard) no long offers Carbon projects as an option. I tried the same steps with new Cocoa project and always get a "Gcc 4.2 returned exit code 1" error message when I try to build. Anyone else have any success create a new WX XCode project?

P.S.
I tried to build the XCode project included in the "minimal" sample and got tons of errors, so I assume that is way outdated.
Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post by Auria »

As i posted in the other thread, you can use pretty much any project, as long as it's an app bundle. So 'cocoa app' will work too.
"Keyboard not detected. Press F1 to continue"
-- Windows
blizzymadden
Experienced Solver
Experienced Solver
Posts: 50
Joined: Sun Dec 05, 2004 2:44 am

Post by blizzymadden »

Auria wrote:As i posted in the other thread, you can use pretty much any project, as long as it's an app bundle. So 'cocoa app' will work too.
Weird. So, you have had success with this? I guess I will have to try, try again.

I delete main.m, and the other .m and .h file, and then add my own main.cpp. That main.cpp compiles, but when I build a target I get a meaningless error about gcc returning exit code 1. I entered all of the lib and cppflag stuff, so I'm baffled. There must be a step that I am missing.
Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post by Auria »

If you get an error message, please post it. There's no way I can guess what happens without seeing the message.

Yes, I have tried, but not on Snow leopard though. Can't see why it'd fail, though.
"Keyboard not detected. Press F1 to continue"
-- Windows
elliswr
Earned a small fee
Earned a small fee
Posts: 23
Joined: Sun Apr 05, 2009 2:39 am

Not working for me.

Post by elliswr »

I built like so:

Code: Select all

arch_flags="-arch i386"
./configure --disable-shared --enable-unicode CFLAGS="$arch_flags" CXXFLAGS="$arch_flags" LDFLAGS="$arch_flags" OBJFLAGS="$arch_flags" OBJCXXFLAGS="$arch_flags"
Makes just fine, but when building the Xcode Project from a Cocoa app and deleting the files from the Classes group folder and changing the main.c to a main.cpp with the sample code. And of course following the Wiki to the T for configuring Xcode, I get 71 errors, that mean nothing to me.

Like so:

Code: Select all

  "wxFrame::Create(wxWindow*, int, wxString const&, wxPoint const&, wxSize const&, long, wxString const&)", referenced from:


      wxFrame::wxFrame(wxWindow*, int, wxString const&, wxPoint const&, wxSize const&, long, wxString const&)in main.o

Symbol(s) not found
Collect2: ld returned 1 exit status

Has anyone had success with building an Xcode project from a Cocoa project on Snow Leopard?
blizzymadden
Experienced Solver
Experienced Solver
Posts: 50
Joined: Sun Dec 05, 2004 2:44 am

Re: Not working for me.

Post by blizzymadden »

elliswr wrote:I built like so:

Code: Select all

arch_flags="-arch i386"
./configure --disable-shared --enable-unicode CFLAGS="$arch_flags" CXXFLAGS="$arch_flags" LDFLAGS="$arch_flags" OBJFLAGS="$arch_flags" OBJCXXFLAGS="$arch_flags"
Makes just fine,

...

Has anyone had success with building an Xcode project from a Cocoa project on Snow Leopard?
Stephan said in a bug report that the wx xcodeproj file is out of date and won't work and to just use make for now.

As far as converting a Cocoa project into a wx project, one problem that I just discovered is that XCode silently truncates long file paths when you paste in your "wx-config --cppflags" info. So I guess be careful where you put your wx folder to avoid that.
Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post by Auria »

This error sounds to me like the wx library is not linked in properly, or is of wrong arch
"Keyboard not detected. Press F1 to continue"
-- Windows
elliswr
Earned a small fee
Earned a small fee
Posts: 23
Joined: Sun Apr 05, 2009 2:39 am

Got it to work... for me

Post by elliswr »

Okay, so went back and started looking at it again, and it boiled down to me selecting the wrong build setting before building and going.

I guess x86_64 (64 bit applications) are not available in wxMac 2.8.10?

At any rate, only changing these settings didn't work:pic 2

I also had to change the actual set to build setting:pic 1
Attachments
pic 1
pic 1
pic 2
pic 2
Screen shot 2009-09-16 at 4.57.56 PM.png (35.75 KiB) Viewed 2911 times
Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post by Auria »

Well you set your architecture setting to be 32/64-bit universal. This means it will build your project as 64 bits too - and your wx is probably not built with 64 bits support in. I think wx 2.9.1/3.0 will support that, but you'd need to check

About the Xcode toolbar menu saying i386... Apple had a good idea when introducing it, but I have no clue what the arch setting does there, it seems to be ignored in all projects created using default wizards.
"Keyboard not detected. Press F1 to continue"
-- Windows
blizzymadden
Experienced Solver
Experienced Solver
Posts: 50
Joined: Sun Dec 05, 2004 2:44 am

Post by blizzymadden »

I finally got it to work! With wx 2.9, I was able to follow these instructions:

http://wiki.wxwidgets.org/Creating_Xcod ... plications

And got it to run, couldn't be happier.

The problem I was having is that XCode doesn't seem to like long path names. I put wx in "/Users/Shared" instead of my desktop and tried again and now all is well.
Post Reply