Error "unknown type name __declspec" after Xcode 7.3 upgrade

Hi,

I have a project in Unity 4.6.9p4. This evening I updated my iphone to iOS 9.3, which necessitated an Xcode update to 7.3. After the upgrade, my project that previously compiled just fine is now throwing the error “unknown type name __declspec” whenever I try to compile in Xcode. I double checked this by opening, cleaning, and building a previously-built Xcode project, one that worked fine on my phone. Same error. It throws the error on the first line of this code:

NORETURN static void il2cpp_codegen_raise_exception (Il2CppCodeGenException *ex)
{
    il2cpp::vm::Exception::Raise ((Il2CppException*)ex);
#if __has_builtin(__builtin_unreachable)
    __builtin_unreachable();
#endif
}

Any idea what can be done to avoid this? I am currently downloading the previous version of Xcode but this is going to be a problem for me pretty soon. Thank you for looking!

Ok embarrassing.

As soon as I posted I saw the banner flash by up top saying there’s a new version of Unity that supports Xcode 7.3. I will grab that and give it a shot. Apologies for the spam.

hi @megasweet , we are facing the exact issue. We are on 5.2.4. Can you please let me know which version did you upgrade to resolve this issue?
The thing is, we initially tried upgrading to 5.3 when it came out but had a bunch of issues. Hence we reverted to 5.2.4. I was hoping to not upgrade to 5.3.x to get around this hence wanted to know how you resolved it.

Hi @rai_arpit , I am still on Unity 4.x so I downloaded Unity 4.7.1 last night, which should support iOS 9.3. I ran out of time to install and try it last night but I’m confident it will work. Worst case I can roll back. I am at the end of a multi-year project so I was going a bit crazy and really shouldn’t have upgraded at all.

Apologies that I can’t help you with Unity 5 issues as I am not going to upgrade my project to Unity 5. Best of luck resolving the issue!

If you are like me and can’t upgrade, I got it to “compile” by replacing
#define NORETURN __declspec(noreturn)
with
#define NORETURN attribute((noreturn))
in the il2cpp-config.h

5 Likes

In my case, this can’t solve problem. my env is Unity5.2.4 XCode7.3

It has helped me:

  1. Remove ‘NORETURN’
  2. Clean build
  3. Build it

Like a hack:)

XCode7.3, Unity5.2.2

UPD: XCode7.3, Unity5.3.4f1 - no issue

6 Likes

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

I can’t upgrade to 5.3, because it renders UI.Text one line up, and breaks all my menus. That fix is slated for 5.4, which has been delayed. I can’t even use 5.2, because it drops my 30 FPS iOS game to 12.

I have a fix.

Find the 3 files in the Unity application called il2cpp-codegen.h.

/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.

3 Likes

tks!It’s helpful for me

Thx, jkmn!
Worked for me (Unity 5.3.1f1, Xcode 7.3)

The ‘Delete NORETURN’ method works for me.

To be clear to those who don’t use Xcode for anything but to build to iOS:

  1. Click on the error in xCode (the red icon). The line should now be highlighted.
  2. Place your cursor in front of the word ‘NORETURN’ and backspace until it’s gone.
  3. Go to “Product” and click “Clean.”
  4. Rebuild project by clicking on the play button in the top left corner.

Xcode Version 7.3 (7D175)
Unity Version 5.3.1 (Latest Vuforia-Supported Version)

9 Likes

For 5.2.4f1, as well as deleting NORETURN, also have to delete instances of IL2CPP_NO_INLINE.

2 Likes

Really? I didn’t have to do that…

@jkmn
Today I meet this problem too,but my Unity version is 4.6.3.Will it be solved if I use your mothod to do it?
hope you can understand what i want to said.

for Unity 4.6.3,it can be worked normally.

for Unity 4.6.3,it can be worked normally.

Unity 4.6.3 is pretty old hence may not support xcode latest, I suggest trying upgrade to 4.7.1 as has newer xcode support or try the hack way.

There will always be a issue as Apple releases new versions of Xcode, simply older versions of Unity not support the features.

I had problems with Unity 4.6.2 while compiling with xcode 7.3. Just follow jkmn’s answer. Works like a charm

As someone who doesn’t use Xcode for anything but to build to iOS, I really appreciate your post. It solved my problem.Thanks man

1 Like