App Code Bug in combination with Cocos2d-x - Help Upvote

Hey guys,

I’ve discovered some severe bugs with JetBrains’ App Code in combination with Cocos2d-x.

App Code offers a great number of useful features compared to Xcode (e.g. full C++ refactoring).

Due to these bugs, App Code has issues resolving many symbols and macros of cocos2d-x.

Please help upvote this issue to get it fixed :wink: The upvoting works via the tiny thumbs on the right, next to the “Voters” string.
https://youtrack.jetbrains.com/issue/OC-14175#tab=Comments

Maybe someone of you is even experienced with App Code and knows of a workaround. That would also be highly appreciated.

I use AppCode as well, much better than Xcode

Great to hear that.

Do you also have the issues in this post? Do you have any hints to prevent them?

The guys from JetBrains confirmed them to me, they were able to reproduce them just with these 4 lines.

I’m getting very frustrated with this as well. AppCode is just so much better than XCode, but this issue is just killing me.

I’m currently installing Visual Studio on my Windows Machine to try if this way works. But ideally, we shouldn’t have to leave our Mac to make iOS / Android Apps…

Here’s my other post, if you’re interested:

Don’t forgot to upvote this App Code issue, so they fix it asap.

Voted. Still present in latest EAP build. AppCode is a disaster with Cocos at the moment :cry:

Oddly, for me, the iOS project is fine but the Mac project shows errors like you have and with the cocos2d::Size class as well. Both build and run fine from within AppCode and Xcode though.

I am just trying out AppCode.

Actually scratch that, the iOS project still has errors in the AppCode editor, just different errors :rolling_eyes:

App Code ist a total let down as off now. They told me that the bugs that I found are severe and might take months for them to fix them.

They were even able to reproduce the issue with a very simple test project.

We can’t do much but vote and hope they finally do it.

Seems to parse OK when imported into CLion 2016.2 from CMakeLists.txt, if that helps anyone.

Which is odd since AppCode’s C++ support is supposed to based on CLion’s work.

I haven’t looked at how to make it run from CLion (is it possible?), but it should work to edit in CLion and run from Xcode…

I might finally have to learn CMake :wink:

Urgh, that doesn’t sound really fun to do, but definitely a good find!

Could you send a mail to JetBrains and tell them that you get it to work in CLion, referencing that other ticket?
They told me that it’s an underlying CLion bug, but maybe they’re on the wrong track here.

If you get it to work with CLion and CMakeList please report back how you did it :wink:

I had to tweak the cocos generated project CMakeLists.txt file just a bit, but this gets the macOS HelloWorld binary running with the absolute latest Cocos pulled from github:
http://pastebin.com/ABbUsA31

I added the following to the standard generated CMakeLists.txt:

if ( MACOSX )
  include_directories(
    ${COCOS2D_ROOT}/external/glfw3/include/mac
  )
endif( MACOSX )

...

if( MACOSX )
    pre_build(${APP_NAME}
    COMMAND ${CMAKE_COMMAND} -E remove_directory ${APP_BIN_DIR}
    COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/Resources ${APP_BIN_DIR}
    )
elseif ( WIN32 )...

Really not sure about the remove_directory in that last chunk :rolling_eyes:

iOS should be similar I think, but TBH this is probably enough for now.

Incidentally, I opened an old Cocos 3.3 project and the same code that’s causing problems pasted in parses fine…

AppCode 2016.2.3 + Cocos 3.3

AppCode 2016.2.3 + Cocos 3.13.1

Now that’s interesting…probably something in the header-import structure of Cocos2d-x changed that now triggers the bug.

Update: based on git tags, cocos2dx-3.10 is fine, cocos2dx-3.11 is not. Unfortunately that gap represents about five months of commits.

Seems to be the changes to CCPlatformConfig.h in this merge, but why they are breaking AppCode is not clear.

If I revert the changes above, AppCode is able to parse the HelloWorldScene.cpp without issue.

1 Like

Wow, you’re doing a really great job at track it down.

Are these changes in the CCPlatformConfig.h super relevant? Or just for better looks?

You should definitely share you findings with the guys at JetBrains / or link this thread. They might really benefit from it.

Done.

You can bodge the latest Cocos to work with AppCode by hardcoding CC_TARGET_PLATFORM in CCPlatformConfig.h as below. Run “File > Invalidate Caches / Restart” in AppCode after changing this.

“neater” solutions such as #define-ing out the Mac/iOS section don’t work. It seems you need to actually comment out those lines to avoid triggering the parsing bugs :rolling_eyes:

Awesome,

Wait…does this mean that the automatic setting for iOS and Android builds does no longer work if doing this?

Or did you find a way to detect Android otherwise?

No, it’s hardcoded for iOS. I’m not building for Android. You could try this:

// Apple: Mac and iOS
#if defined(__APPLE__) && !defined(ANDROID) // exclude android for binding generator.
//    #include <TargetConditionals.h>
//    #if TARGET_OS_IPHONE // TARGET_OS_IPHONE includes TARGET_OS_IOS TARGET_OS_TV and TARGET_OS_WATCH. see TargetConditionals.h
//        #undef  CC_TARGET_PLATFORM
//        #define CC_TARGET_PLATFORM         CC_PLATFORM_IOS
//    #elif TARGET_OS_MAC
//        #undef  CC_TARGET_PLATFORM
//        #define CC_TARGET_PLATFORM         CC_PLATFORM_MAC
//    #endif
    #undef  CC_TARGET_PLATFORM
    #define CC_TARGET_PLATFORM         CC_PLATFORM_IOS
#endif

It means it assumes iOS if you’re building on a Mac but not for Android, so maybe that will be OK for you.

1 Like