I have a static library, whose code was in c++. I want to use it in an objective C app.
(I have been using C libraries preiously, they have been working fine.)
I added the library and tried to build, it couldn't because 'namespace' and vectors were somewhere used in the header files. So, I had to change the type of my objective C file to objective c++. (I didn't change the extension to .mm). Since this file was to be included in another file, that file also had to be changed to c++, similarly for few other files.
Now there is no namespace error. But now when I build, it cribbs that it can't find the referenced symbols. I now changed the extension to .mm, still the same. I did some searching, I read some things about mangling. I don't understand what that is, but here is something i tried,
Instead of calling the c++ function directly, I created a C function, whose declaration was preceded by 'extern "C"', and the library call was present in this C function. Still the same. I preceded the implementation of the c function by 'extern "C"', still the same.
I also read that if xcode sees .mm extension, only then it uses g++ compiler. and in that case there is no need for extern "C". is it?
Do I need to add some compiler flags in the Other compiler flags target setting?
ld: warning: directory not found for option '-F-F/Users/username/Desktop/projectFolder'
Undefined symbols for architecture armv7:
"IIS::Image::Image::Image(unsigned int, unsigned int, ImageFormat)", referenced from:
-[ImageEditorSupport loadToolKitForImage:width:height:length:] in ImageEditorSupport.o
"IIS::Image::Image::getNumComponents(unsigned int&) const", referenced from:
-[ImageEditorSupport loadToolKitForImage:width:height:length:] in ImageEditorSupport.o
"IIS::Image::ToolKit::adjustSaturation(IIS::Image::Image const&, unsigned int, IIS::Image::Image&)", referenced from:
-[ImageEditorSupport applyToolkitForEditID:intensity:] in ImageEditorSupport.o
"IIS::Image::ToolKit::adjustContrast(IIS::Image::Image const&, unsigned int, IIS::Image::Image&)", referenced from:
-[ImageEditorSupport applyToolkitForEditID:intensity:] in ImageEditorSupport.o
"IIS::Image::Image::Image(unsigned int, unsigned int, ImageFormat, void*, unsigned int)", referenced from:
_create_image_using_buffer in ImageEditorSupport.o
"IIS::Image::ToolKit::adjustColorTemp(IIS::Image::Image const&, int, IIS::Image::Image&)", referenced from:
-[ImageEditorSupport applyToolkitForEditID:intensity:] in ImageEditorSupport.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have also checked several times that i have added the correct library search paths. I am doubtful about the two '-F-F'. I was expecting only one.
*Edit :*In the warning -F-F/Users/username/Desktop/projectFolder
does it mean that it is searching for a path -F/Users/username/Desktop/projectFolder
instead of /Users/username/Desktop/projectFolder
? How could that extra -F
come?