I’ve integrated the ZXing QR Code reader library (ZXingWidget) into my iPhone app, but it conflicts with a function from within the CocoaLumberjack logging library that I am also using.
Undefined symbols for architecture i386:
"ExtractFileNameWithoutExtension(char const*, signed char)", referenced from: ...
DDLog.h
NSString *ExtractFileNameWithoutExtension(const char *filePath, BOOL copy);
#define THIS_FILE (ExtractFileNameWithoutExtension(__FILE__, NO))
DDLog.m
NSString *ExtractFileNameWithoutExtension(const char *filePath, BOOL copy) { ...
As I call it in:
DDLogVerbose(@"%@:%@", THIS_FILE, THIS_METHOD);
The cause for this is that whichever Obj-C file contains the headers:
// import QR Code reader APIs
#import "ZXingWidgetController.h"
#import "QRCodeReader.h"
its file extension must be changed from .m to .mm for proper C++ support.
But then I lose my *DDLogVerbose(@”%@:%@”, THIS_FILE, THIS_METHOD);* functionality.
What am I missing here to have these two play nice with each other?
If you’re including C headers that aren’t “C++-ified” into a C++ or Objective C++ file, you need to tell the compiler. Something like
in your
.mms should work. Alternatively, ifDDLog.his your file, you can do something likeA web search for “extern C” should provide more details/examples.