[fix-it] iOS 'Point' type is the same as cocos2d-x 3.0 alpha 'Point'

i fix it:

  1. AppController.h is object-c header file. And my source is cpp. Only .mm file could include object-c header file. — so don’t use cpp to include .mm head file
  2. Calling Objective-C method from C++ method — may be this can help me
    http://stackoverflow.com/questions/1061005/calling-objective-c-method-from-c-method

=
cocos2d-x-3.0alpha0-pre + iOS7 SDK + xcode Version 5.0 (5A1413)

.cpp

  1. include follow
    #if (CC_TARGET_PLATFORM CC_PLATFORM_IOS)
    #include “AppController.h”
    #endif

  2. build error, because iOS ‘Point’ type is the same as cocos2d-x 3.0 alpha ‘Point’
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/include/MacTypes.h:534:9: Reference to ‘Point’ is ambiguous

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:377:43: Unknown type name ‘NSString’


2.png (221.2 KB)

Try USING_NS_CC maybe?

i know to add cocos2d::Point to .cpp, but iPhoneOS7.0.sdk/usr/include/MacTypes.h is iOS system SDK, so don’t change system SDK.
Maybe cocos2d-x use Point type is not good?

Well, yea, I agree with you, maybe that’s why it was CCPoint before.

any one have fix this?

When conflicts exist, please add namespace cocos2d:: before Point .

@James Chen
i know to add cocos2d::Point to .cpp, but iPhoneOS7.0.sdk/usr/include/MacTypes.h is iOS system SDK, so don’t change system SDK.
Maybe cocos2d-x use Point type is not good?

@kyo kyo,

but iPhoneOS7.0.sdk/usr/include/MacTypes.h is iOS system SDK, so don’t change system SDK.

I don’t know why you have to change the system SDK.

@James Chen
you can try this, it will tips iOS7 SDK MacTypes.h Reference to ‘Point’ is ambiguous

.cpp

1. include follow
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
#include "AppController.h" 
#endif

2. build error, because iOS 'Point' type is the same as cocos2d-x 3.0 alpha 'Point'
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/include/MacTypes.h:534:9: Reference to 'Point' is ambiguous

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:377:43: Unknown type name 'NSString'

@James Chen
i have take a picture for error, you can see

AppController.h is object-c header file. And your source is cpp. right?
Only .mm file could include object-c header file.

@james chen

  1. AppDelegate.cpp include #import “GCHelper.h” , GCHelper.mm
    2.*.cpp, include AppController.h, AppController.mm

@james chen
how use .cpp(c++) to use .mm(c++ or object c)

@james chen
AppController.h is object-c header file. And your source is cpp. right? Only .mm file could include object-c header file.

i fix it:

  1. AppController.h is object-c header file. And my source is cpp. Only .mm file could include object-c header file. — so don’t use cpp to include .mm head file
  2. Calling Objective-C method from C++ method — may be this can help me
    http://stackoverflow.com/questions/1061005/calling-objective-c-method-from-c-method

I had the same problem.
It turned out “MacTypes.h” was referenced in one file in my project, probably because of a little to much “help” from my ide. Anyway, removed that, and I was up and running again…
-Christian

I had the same problem…:frowning:

cocos2d-x-3.0alpha1 + iOS7 SDK + xcode Version 5.0 (5A1413)

Did you try to search for “MacTypes.h” in all your own class files, and see if you have unwanted includes?

@Christian Aamodt

no, but…i just try to build it’s default project.

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk/usr/include/MacTypes.h:533:16: Reference to ‘Point’ is ambiguous

what is “usr/include/MacTypes.h”?

I’m having the same issue. My project uses RakNet which includes MacTypes.h on anything Apple.

I have no problem adding cocos2d::, but the problem is other files I include like Sprite.h, etc, all get the ambiguous issues as well.

1 Like

Y H wrote:

I’m having the same issue. My project uses RakNet which includes MacTypes.h on anything Apple.
>
I have no problem adding cocos2d::, but the problem is other files I include like Sprite.h, etc, all get the ambiguous issues as well.

.cpp don’t include .mm head file(.h)