Re: C++ file linking issue
Re: C++ file linking issue
- Subject: Re: C++ file linking issue
- From: Bavarious <email@hidden>
- Date: Sun, 18 Jan 2015 06:52:59 -0200
On Jan 18, 2015, at 06:46, tridiak <email@hidden> wrote:
>
> I have problem with a C++ file finding a symbol in a dynamic library.
>
> ==============================
> // library header file
> #ifdef __clpusplus
There’s a typo there: clp → cpl.
> extern "C" {
> #endif
> extern SOArrayRef SOGetAllSpells();
> #ifdef __clpusplus
Same typo again.
> }
> #endif
>
> ===============================
> // Test.m file
>
> void Test1() {
> SOArrayRef ary=SOGetAllSpells();
> }
> ================================
> // TestFile.cpp file
>
> void SATest() {
> SOArrayRef ary=SOGetAllSpells();
> }
> ===============================
>
> When I attempt to compile, the compiler spews out
> Undefined symbols for architecture x86_64:
> "SOGetAllSpells()", referenced from:
> _SATest in TestFile.o
> ld: symbol(s) not found for architecture x86_64
>
> The error only occurs in the C++ file, not the .m (or C) file.
> The symbol exists otherwise it would complain ‘_Test1 in Test.o' also.
> If I remove the symbol reference from the C++ file, it compiles without any issue.
> The library symbol exists, nm verified it for me.
>
> OS 10.10.1, XCode 5.1.1 & 6.1
>
> Any idea why this is happening?
_______________________________________________
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