PDA

View Full Version : blocking libstc++.a on PB


BinarySpike
2005.05.27, 04:51 PM
I've had two errors so far with libstc++.a

One is a name clash.
(mulitple defenitions)

The other is a "Can't find libstc++.a"
(on panther under xcode)


I'm working on a PB project for bzflag. (libcurl issuse)
The main problem is that I get the mulitple defenitions error when compiling.
(linking)

And, on my file manager I'm working on I get a file not found when a friend tries to compile it.

What does libstc++.a do?
Is it required for a .cpp/.cxx to compile?

I know my file manager only uses printf for debugging. (untill I get the bugs out)
(I was using cout untill my friend got that error)

So, how do I block libstc++.a from linking?
I don't have it in my project.
I just have .cpp or .cxx files.

And what does libstc++.a do for a C++ file?


ThankS!

Dan Potter
2005.05.27, 06:15 PM
libstdc++ is to C++ as libc is to C. (you did mean libstdc++ right, and not libstc++?) You can write C++ apps without making use of it but they will basically just be C.

I dunno if this is related to your troubles, but Tiger switched libstdc++.a (static lib) to be libstdc++.dylib (dynamic). Panther 10.3.9 installs this support. Easiest solution for a quick fix is to use gcc_select to go back to 3 on Tiger, then restart Xcode and recompile.

BinarySpike
2005.05.27, 08:43 PM
This is the exact lib:
libstdc++.a(string-inst.o)
(the .o is what source file it's in)



Here's the EXACT error (by gcc):
ld: multiple definitions of symbol std::basic_string<char, std::char_traits<char>, std::allocator<char> >::assign(char const*, unsigned long)

/Users/nathan/Desktop/bzflag-2.0.2.20050318/src/game/libGame.a(MsgStrings.o) definition of std::basic_string<char, std::char_traits<char>, std::allocator<char> >::assign(char const*, unsigned long) in section (__TEXT,__text)

/usr/lib/gcc/darwin/3.1/libstdc++.a(string-inst.o) private external definition of std::basic_string<char, std::char_traits<char>, std::allocator<char> >::assign(char const*, unsigned long) in section (__TEXT,__text)



I have no idea how to fix this.
(and the code is not mine)

Dan Potter
2005.05.27, 08:47 PM
Weird.. was it compiled with different compiler versions, Xcode versions, OS versions, etc? (I mean libGame vs the rest)

Could also be that libstdc++.a is getting linked into libGame somehow, which should not be happening. For a static library (.a) there shouldn't be any other libraries linked into it generally. Especially not that one. :) So there might be an issue in the Xcode project (wrong project type or something).

EDIT: Actually just looked over the error again, and I think my second point is invalid because it's actually in a non-libstdc++ .o file. So never mind on that. It's more like the linker can't figure out how to eliminate multiple template instantiations of the same type, which is more like a version mismatch issue (top comment). It's still very strange though, you'd think you'd just get missing symbol errors or something. If you can do so and haven't done so, I'd still recommend doing the full clean and rebuild of everything (libGame and your project).

BinarySpike
2005.05.27, 09:01 PM
libGame was made with "make" command in terminal.
(this is open-source game that I'm re-compiling)

I'll do a clean libGame with all the other libXXXXX.a stuff.


I'd kill for a PB project that's up to date!

I'm having trouble with my version of libcurl.
It's not linking correctly.
(and the newer versions of bzflag HAVE to have it for something called "ares")

Anyway, I know PB will give me the info needed for libcurl.
(to link properly)