2

.mm ファイルを別のファイルにインポートしようとすると、エラーが発生します。そのようなビルド:

最初のクラスFailedMenuLayerは .mm で、その .h に含まれています:

#import "gameScene.h"

2 番目のクラス gameSceneは .mm で、その .h に含まれています。

#import "FailedMenuLayer.h"
   FailedMenuLayer *menuGO; //here i get the error: unknown type FailedMenuLayer .

何故ですか ?

4

2 に答える 2

2

It looks like an import cycle.

One way to fix it is to move the "gameScene.h" import to the .mm file. It's actually a good practice to keep the imports in the .h file limited only to what you actually need in the header and keep everything else in the .mm file.

If you need the import in the header try using @class instead of #import;

@class gameScene;

Don't forget to import gameScene.h in the .mm file also.

于 2013-06-18T11:09:43.370 に答える
0

「.mm」ファイルをインポートしているのではなく、ヘッダーをインポートしています。

ビルド フェーズを確認し、そこにリストされる .mm ファイルのソースをコンパイルします。それはあなたの問題かもしれません

于 2013-06-18T09:25:39.667 に答える