I have a project coded in objective c that uses the SimplePing.h as provided by Apple.
The code was running perfectly until I updated Xcode to v9.0; it's not compiling anymore with an Error in the file SimplePing.h provided by Apple here SimplePing.h
C++ requires a type specifier for all declarations
The Error is generated on each of those lines in SimplePing.h
check_compile_time(sizeof(IPHeader) == 20);
check_compile_time(offsetof(IPHeader, versionAndHeaderLength) == 0);
check_compile_time(offsetof(IPHeader, differentiatedServices) == 1);
check_compile_time(offsetof(IPHeader, totalLength) == 2);
check_compile_time(offsetof(IPHeader, identification) == 4);
check_compile_time(offsetof(IPHeader, flagsAndFragmentOffset) == 6);
check_compile_time(offsetof(IPHeader, timeToLive) == 8);
check_compile_time(offsetof(IPHeader, protocol) == 9);
check_compile_time(offsetof(IPHeader, headerChecksum) == 10);
check_compile_time(offsetof(IPHeader, sourceAddress) == 12);
check_compile_time(offsetof(IPHeader, destinationAddress) == 16);
The Class SimplePing.h includes the following class
#include <AssertMacros.h> // for __Check_Compile_Time
in which the code of check_compile_time is defined as below:
#ifndef __Check_Compile_Time
#ifdef __GNUC__
#define __Check_Compile_Time( expr ) \
extern int compile_time_assert_failed[ ( expr ) ? 1 : -1 ] __attribute__( ( unused ) )
#else
#define __Check_Compile_Time( expr ) \
extern int compile_time_assert_failed[ ( expr ) ? 1 : -1 ]
#endif
#endif
First Question: How can I solve this? Second Question: I cannot seem to modify the AssertMacros.h file, it is locked.. should i unlock it and fix it? or is there anything else I can do to fix the problem?