Re: C++ STL linking error
Re: C++ STL linking error
- Subject: Re: C++ STL linking error
- From: Marshall Clow <email@hidden>
- Date: Sun, 03 Mar 2013 16:10:12 -0800
On Mar 3, 2013, at 3:47 PM, Jeffrey Walton <email@hidden> wrote:
> On Sun, Mar 3, 2013 at 6:41 PM, Todd Heberlein <email@hidden> wrote:
>> I'm having a brain fart here. I hope someone can point out an obvious error.
>>
>> I have my own C++ library. When I link against it in a Cocoa app (with the appropriate files set to .mm), everything works fine.
>>
>> But when I start a new "Command Line Tool" project and try to link against the library, I get a lot of errors about missing STL symbols.
>>
>> Undefined symbols for architecture x86_64:
>> "std::string::data() const", referenced from:
>> netsq::Buffer::operator<<(std::string const&) in libNetSQ.a(NetsqBuffer.o)
>> "std::string::length() const", referenced from:
>> netsq::Buffer::operator<<(std::string const&) in libNetSQ.a(NetsqBuffer.o)
>> "std::allocator<char>::std::allocator()", referenced from:
>>
>> What is strange, I can use the undefined symbol just fine in my code
>>
>> const char* p_data;
>> std::string foo = "bar";
>> p_data = foo.data();
>>
>> // netsq::Buffer myBuf;
>>
>> But when I uncomment the myBuf declaration, I get the linking error above (along with a bunch of other missing STL symbols).
>>
>> Any idea where I am screwing up?
> http://marshall.calepin.co/c-and-xcode-46.html? (Thanks to Anton
> Korobeynikov on another list for pointing out Marshall Clow's blog).
Thanks for the link ;-)
To elaborate further, I suspect that your C++ library was compiled using libstdc++, and your new C++ tool is using libc++.
Rebuild your C++ library using the same compiler and standard library and you should be golden.
-- Marshall
Marshall Clow Idio Software <mailto:email@hidden>
A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait).
-- Yu Suzuki
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden