Re: Symbol not found when compiling MM (ObjC++) file
Re: Symbol not found when compiling MM (ObjC++) file
- Subject: Re: Symbol not found when compiling MM (ObjC++) file
- From: "Stephen J. Butler" <email@hidden>
- Date: Fri, 05 Aug 2011 22:53:52 -0500
On Fri, Aug 5, 2011 at 9:57 AM, Alexander Hartner <email@hidden> wrote:
> Now when I import Logger.h and use it from a Objective C (.m) file everything seems to work great. However as soon I as import it and use it from a Objective C++ (.mm) file I get the following link error:
>
> Ld [REMOVED] normal i386
> setenv MACOSX_DEPLOYMENT_TARGET 10.4
> /Developer/usr/bin/g++-4.0 -arch i386 -dynamiclib -isysroot /Developer/SDKs/MacOSX10.4u.sdk -L[REMOVED]/Release -F[REMOVED]/Release -filelist [REMOVED].LinkFileList -install_name [REMOVED] -mmacosx-version-min=10.4 -framework Foundation -framework Cocoa -framework SyncServices -framework Foundation -framework IOKit -lcrypto.0.9.7 -lssl.0.9.7 -single_module -compatibility_version 1 -current_version 9 -o [REMOVED]
>
> Undefined symbols:
> "ABSLog(NSString*, ...)", referenced from:
> -[SoapAdaptor initWithPreferences:] in SoapAdaptor.o
> ld: symbol(s) not found
> collect2: ld returned 1 exit status
http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html#faq-32.3
Basically, the C++ compiler thinks ABSLog is a C++ function, and it's
undergoing name mangling. So what you have to do is tell the C++
compiler that ABSLog is a C function with extern "C" { stuff }
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden