On Aug 5, 2011, at 7:57 AM, Alexander Hartner <[email protected]> wrote:
>
> Logger.h
>
> #import <Foundation/Foundation.h>
> void ABSLogToggle (BOOL debug);
> void ABSLog (NSString *format,...);
[snip]
>
> 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
You need to wrap the contents of your header file with `extern "C"` when
building C++:
#import <Foundation/Foundation.h>
#ifdef __cplusplus
extern "C" {
#endif
void ABSLogToggle(BOOL debug);
void ABSLog(NSString *format,...);
#ifdef __cplusplus
}
#endif
--Kyle Sluder_______________________________________________
Cocoa-dev mailing list ([email protected])
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]