How to get rid of "Unknown type name '__declspec'" error in Xcode

I have a fix for if you can't upgrade to the Unity version that fixes this.

Find the 3 files in the Unity application called il2cpp-codegen.h. For example, on Mac Unity, they're here:

/Applications/Unity5.1.4/Unity.app/Contents/PlaybackEngines/WebGLSupport/BuildTools/Libraries/libil2cpp/include/codegen/il2cpp-codegen.h
/Applications/Unity5.1.4/Unity.app/Contents/PlaybackEngines/iossupport/il2cpp/libil2cpp/include/codegen/il2cpp-codegen.h
/Applications/Unity5.1.4/Unity.app/Contents/Frameworks/il2cpp/libil2cpp/codegen/il2cpp-codegen.h

Find this line in those:

NORETURN static void il2cpp_codegen_raise_exception (Il2CppCodeGenException *ex)

Delete the "NORETURN" from each, and save the files. It should work now.


Unity just released a new version, 5.3.2, to deal with this issue.


I had a similar issue in a library that embed a C++ dll.

If you don't want to upgrade I believe you can replace:

#define NORETURN __declspec(noreturn)

by

#define NORETURN __attribute__((noreturn))

Tags:

Ios

Xcode

Unity3D