SDL doesn't like C++...

Moderator
Posts: 704
Joined: 2002.04
Post: #1
I'm currently setting up a 'new' machine (Dual 450Mhz G4, 1GB RAM, 10.3.9), and I've run into a problem after installing the development tools (Xcode 1.1) and SDL: whenever I try to compile a C++ project using SDL (even the SDL project templates), I receive the following error:

Quote:ld: /usr/lib/gcc/darwin/3.3/libstdc++.a(eh_exception.o) illegal reference to symbol: operator delete(void*) defined in indirectly referenced dynamic library /usr/lib/libstdc++.6.dylib

These are the steps I've taken from a clean (but fully updated) install of 10.3.9 to try to install the development tools and SDL:

  1. Installed Xcode 1.1 (Easy Install)
  2. Copied SDL.framework 1.2.11 to /Library/Frameworks/
  3. Copied contents of SDL-devel-1.2-11-extras.dmg/TemplatesForProjectBuilder/ into /Library/Application Support/Apple/Developer Tools/Project Templates/Application/ (except the file Application.trgttmpl, as it isn't mentioned in the SDL documentation?
  4. Compiled a C++ Tool template-project, no problem.
  5. Compiled an C SDL Application template-project project, no problem.
  6. Created a fresh C SDL Application template-project, renamed main.c to main.cpp, tried to compile, but... Cry

Mark Bishop
--
Student and freelance OS X & iOS developer
Quote this message in a reply
Member
Posts: 114
Joined: 2005.03
Post: #2
Do you include libstdc++?
Quote this message in a reply
Moderator
Posts: 1,140
Joined: 2005.07
Post: #3
For some reason, it looks like you're trying to statically link libstdc++ when it's already dynamically linked. You might want to look into the build options, and make sure it's dynamically linked in there. I'm guessing that SDL (or another framework) already dynamically links it, so it's looking for it in 2 places. Either that, or the other framework is statically linking it when you're dynamically linking it in your framework.
Quote this message in a reply
Moderator
Posts: 704
Joined: 2002.04
Post: #4
I just tried an eyeball-diff of the build settings/style used to build the project on the new machine, and the old, and they are identical...

Mark Bishop
--
Student and freelance OS X & iOS developer
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #5
The latest SDL is built with GCC 4, which uses a libstdc++ that's incompatible with that of GCC 3. You need to upgrade your compiler, downgrade your SDL to one that was built with GCC 3, or build SDL yourself with GCC 3.

Or you could search the boards, where you'd find all the other threads where I've said that Rasp
Quote this message in a reply
Moderator
Posts: 704
Joined: 2002.04
Post: #6
OSC, unfortunately the error occurs even if I've dropped into /Library/Frameworks/ a version of SDL I know works with C++ under 10.3.9 - because I've just copied it off of the older system...

Mark Bishop
--
Student and freelance OS X & iOS developer
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #7
Weird.

I'd start by looking at all the libraries and frameworks you're using with otool -L to find out which is using /usr/lib/libstdc++.6.dylib. Having found the culprit(s), I'd then be investigating whether having -lstdc++ *before* them in the link command makes any difference.
Quote this message in a reply
Apprentice
Posts: 5
Joined: 2009.03
Post: #8
Did you solve your problem, sealfin ? Because i have exactly the same one. My SDL/OpenGL Project also won't compile (link) after a fresh Panther install, giving me the same errors which you have encountered. I also tried to downgrade SDL with no luck. I then attempted to compile SDL 1.2.9 but linking failed because of the same error:

ld: /usr/lib/gcc/darwin/3.3/libstdc++.a(stl-inst.o) illegal reference to symbol: std::__throw_bad_alloc() defined in indirectly referenced dynamic library /usr/lib/libstdc++.6.dylib

However compilation of lib3ds, freetype and ftgl libraries completed just fine.

*sigh* i would like to continue my work on MacBomber, but i can't because of this stupid problem Cry . Any clues ?
Quote this message in a reply
Moderator
Posts: 704
Joined: 2002.04
Post: #9
quarus Wrote:Did you solve your problem, sealfin ?
Not as yet; I intend to duplicate exactly the installation of SDL on the newer system as on the older system, but as yet haven't had the time to try...

Mark Bishop
--
Student and freelance OS X & iOS developer
Quote this message in a reply
Apprentice
Posts: 5
Joined: 2009.03
Post: #10
sealfin Wrote:Not as yet; I intend to duplicate exactly the installation of SDL on the newer system as on the older system, but as yet haven't had the time to try...

Good luck with that! After a bit more googling it seems like that a quicktime software update is the one to blame(?) And examining the SDL Framework with otool shows that it loads quicktime dynamically. I will try to reinstall panther while avoiding the quicktime upgrade. I will post in a few days if it worked...
Quote this message in a reply
Member
Posts: 30
Joined: 2006.05
Post: #11
I had the same problem... I didn't reinstall the OS, I found a (difficult) way of reverting Quicktime to the older version, fixing the issue.

After upgrading to Tiger, fortunately there hasn't been any trouble.

You'd think Quicktime would give us an EASY way to revert to an earlier version...
Quote this message in a reply
Apprentice
Posts: 5
Joined: 2009.03
Post: #12
Greywhind Wrote:I had the same problem... I didn't reinstall the OS, I found a (difficult) way of reverting Quicktime to the older version, fixing the issue.

After upgrading to Tiger, fortunately there hasn't been any trouble.

I really hope that i am not forced to upgrade. I would hate to give apple my money, because they screwed up Sad

Well, we will see....
Quote this message in a reply
Apprentice
Posts: 5
Joined: 2009.03
Post: #13
Reinstalling panther without upgrading Quicktime solved the problem. Smile
Quote this message in a reply
Sage
Posts: 1,066
Joined: 2004.07
Post: #14
quarus Wrote:Reinstalling panther without upgrading Quicktime solved the problem. Smile
What you could do now, is find the /System/Library/Frameworks/QuickTime.framework, duplicate it into ~/Library/Frameworks, then upgrade QuickTime. Then in your SDL apps, just link to the ~/Library/Frameworks/QuickTime.framework instead of the /System/Library/Frameworks/QuickTime.framework. Then you get access to the best of both worlds.
Quote this message in a reply
Apprentice
Posts: 5
Joined: 2009.03
Post: #15
Nick Wrote:What you could do now, is find the /System/Library/Frameworks/QuickTime.framework, duplicate it into ~/Library/Frameworks, then upgrade QuickTime. Then in your SDL apps, just link to the ~/Library/Frameworks/QuickTime.framework instead of the /System/Library/Frameworks/QuickTime.framework. Then you get access to the best of both worlds.

Thanks for your tip! But where can i specify the quicktime framework to be linked against? I guess i have to add a Linker flag entry? Or do i have to drag the right quicktime framework into my project?
Quote this message in a reply
Post Reply