• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: C++ file linking issue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C++ file linking issue


  • Subject: Re: C++ file linking issue
  • From: Roland King <email@hidden>
  • Date: Sun, 18 Jan 2015 16:52:57 +0800

Is that code really copy and pasted, because you have a spelling error in the 

#ifdef __cplusplus 

line. You’ve switched the p and the l

On 18 Jan 2015, at 16:46, tridiak <email@hidden> wrote:

I have problem with a C++ file finding a symbol in a dynamic library.

==============================
// library header file
#ifdef __clpusplus
extern "C" {
#endif
extern SOArrayRef SOGetAllSpells();
#ifdef __clpusplus
}
#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

  • Follow-Ups:
    • Re: C++ file linking issue
      • From: tridiak <email@hidden>
References: 
 >C++ file linking issue (From: tridiak <email@hidden>)

  • Prev by Date: Re: C++ file linking issue
  • Next by Date: Re: C++ file linking issue
  • Previous by thread: Re: C++ file linking issue
  • Next by thread: Re: C++ file linking issue
  • Index(es):
    • Date
    • Thread