Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

xcode

ios

unity3d

I tried to build and run my first project for Google Cardboard in Xcode.

I first encountered something that basically said my signature was incorrect and asked me to sign in so that the computer could fix it (which it seemed to). (I include this info in case it is related to the error in some way.)

I then encountered the error Unknown type name '__declspec' and have no idea how to fix it.

This issue is also found here but there are no answers to it. A Google search yielded about 50 results, so it seems relatively uncommon.

What would be my best course of action?

like image 498
Pro Q Avatar asked Feb 04 '16 04:02

Pro Q


3 Answers

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.

like image 56
Almo Avatar answered Nov 01 '22 16:11

Almo


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

like image 27
Pro Q Avatar answered Nov 01 '22 14:11

Pro Q


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))
like image 32
tiguero Avatar answered Nov 01 '22 15:11

tiguero