Including POCO header files in Objective C ++. Mm file results in compilation error on Xcode 6
I see the following weird error if I include any POCO header file in the .mm file or .h file. If I include the headers in the .cpp file, then the project compiles successfully. Any help or sample code to make the POCO work with an objective C project would be noticeable.
Here is the code:
//File: test.mm
#import "test.h"
#include "Poco/JSON/Object.h"
@implementation test
-(void)test{
Poco::JSON::Object obj;
}
@end
Here is a screenshot of the error
Detailed error:
In file included from /Users/a/Desktop/test/theta/theta/test.mm:10:
In file included from /Users/a/Desktop/poco-1.6.0- all/JSON/include/Poco/JSON/Object.h:24:
In file included from /Users/a/Desktop/poco-1.6.0-all/JSON/include/Poco/JSON/Array.h:25:
In file included from /Users/a/Desktop/poco-1.6.0-all/Foundation/include/Poco/Dynamic/Var.h:26:
In file included from /Users/a/Desktop/poco-1.6.0-all/Foundation/include/Poco/Dynamic/VarHolder.h:24:
In file included from /Users/a/Desktop/poco-1.6.0-all/Foundation/include/Poco/NumberFormatter.h:24:
/Users/a/Desktop/poco-1.6.0-all/Foundation/include/Poco/NumericString.h:261:8: error: expected member name or ';' after declaration specifiers
void check(char* ptr)
~~~~ ^
+3
Abhinav
source
to share
1 answer
ok, the reason for the error is that the POCO header conflicts with one of the header files in the OSX SDK. Adding the following line before including any headers fixes the compilation issue.
#undef check
+3
Abhinav
source
to share