My problem is a little complex:
Library: I have a library written in C and C++. It compiles perfecly in XCode with Apple LLVM. The work of this library itself is done by the C code while the C++ part is just a C++ interface because I prefer C++. In theory I need to use only C++ to comunicate with it.
The application: I have an application in Objective-C that uses the library above. Of couse, as the communication with my library is done via C++ I need to have a .mm file in order to call my library from "Objective-C++".
During the compilation... several issued of "C" languages happen:
- error: non-const static data member must be initialized out of line
- error: statement expression not allowed at file scope
- etc...
It only happens with Objective-C++
- Objective-C++ (app) -> C++ headers (lib) -> C headers (lib, with extern "C") -> NOT OK!!! WHY?
If I make another C++ application for test of library, it goes ok
- C++ (app) -> C++ (lib) -> C header (lib, with extern "C") -> OK
Detail: I am always using the Apple LLVM compiler here
The question: How do I compile C code from C++ from Objective-C++ code? Why it's different than compile from a regular C++ code?