Reputation: 415
I am working on adding code to an existing iphone app (written by someone else) that uses the card.io project. This is the first change i've attempted. The app compiles and runs fine with no changes but then when I try to add an empty .cpp and .h file to my xcode project I start getting syntax errors in an unrelated obj-c header file called CardIOMacros.h. I am using xcode 7.2 and compiling for an iphone 4s device.
The process I went through to add the .cpp and .h file was
Below is the file where I am getting errors. The errors are shown below the code.
//
// CardIOMacros.h
// See the file "LICENSE.md" for the full license governing this code.
//
// CardIOLog is a replacement for NSLog that logs iff CARDIO_DEBUG is set.
#if CARDIO_DEBUG
#define CardIOLog(format, args...) NSLog(format, ## args)
#else
#define CardIOLog(format, args...)
#endif
@interface CardIOMacros : NSObject
+ (id)localSettingForKey:(NSString *)key defaultValue:(NSString *)defaultValue productionValue:(NSString *)productionValue;
+ (NSUInteger)deviceSystemMajorVersion;
+ (BOOL)appHasViewControllerBasedStatusBar;
@end
#define iOS_MAJOR_VERSION [CardIOMacros deviceSystemMajorVersion]
#define iOS_8_PLUS (iOS_MAJOR_VERSION >= 8)
#define iOS_7_PLUS (iOS_MAJOR_VERSION >= 7)
#define iOS_6 (iOS_MAJOR_VERSION == 6)
#define iOS_5 (iOS_MAJOR_VERSION == 5)
Compliler Errors
/Users/michael/sdev/projectname/ios/card.io-iOS-20151210/Classes/CardIOMacros.h
/Users/michael/sdev/projectname/ios/card.io-iOS-20151210/Classes/CardIOMacros.h:14:1: Expected unqualified-id
/Users/michael/sdev/projectname/ios/card.io-iOS-20151210/Classes/CardIOMacros.h:18:1: Expected external declaration
/Users/michael/sdev/projectname/ios/card.io-iOS-20151210/Classes/CardIOMacros.h:18:4: C++ requires a type specifier for all declarations
/Users/michael/sdev/projectname/ios/card.io-iOS-20151210/Classes/CardIOMacros.h:18:15: Expected ';' after top level declarator
/Users/michael/sdev/projectname/ios/card.io-iOS-20151210/Classes/CardIOMacros.h:20:1: Expected external declaration
/Users/michael/sdev/projectname/ios/card.io-iOS-20151210/Classes/CardIOMacros.h:20:4: C++ requires a type specifier for all declarations
/Users/michael/sdev/projectname/ios/card.io-iOS-20151210/Classes/CardIOMacros.h:20:9: Expected ';' after top level declarator
/Users/michael/sdev/projectname/ios/card.io-iOS-20151210/Classes/CardIOMacros.h:22:1: Expected unqualified-id
The .h and .cpp file are empty and I dont even #include the new c++ header file in any other file. Any help would be appreciated.
Upvotes: 0
Views: 367
Reputation: 9311
Make sure you don't have said header included in ...-Prefix.pch
.
Upvotes: 1