[英]ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
[英]Cocos2d-x - clang: error: linker command failed with exit code 1 (use -v to see invocation)
從《 Cocos2d-x入門指南》一書中進行教程(空中曲棍球)時,我在Cocos2d-x(2.1.5)中得到了這些消息。
我已經檢查了Xcode中的所有“ #include”,BuildPhases等,並在“編譯源代碼”(約250個文件)中執行了“驗證設置”並屏蔽了Internet,希望有人對此表示贊賞。 我尚未在.cpp文件中引用它們。
順便說一句,本書中的Cocos2d-x版本與我使用的版本不同,我檢查了圖書網站並從作者那里找到了這一點: 作者對本教程的發行版發表了評論
這是我第一次嘗試使用非Objective-C和Cocos2d-x。
GameLayer.h:
#ifndef __GAMELAYER_H__
#define __GAMELAYER_H__
#define GOAL_WIDTH 400
#include "cocos2d.h"
#include "GameSprite.h"
using namespace cocos2d;
class GameLayer : public cocos2d::CCLayer {
GameSprite *_player1;
GameSprite *_player2;
GameSprite *_ball;
CCArray *_players;
CCLabelTTF *_player1ScoreLabel;
CCLabelTTF *_player2ScoreLabel;
CCSize _screenSize;
int _player1Score;
int _player2Score;
void playerScore (int player);
public:
~GameLayer();
virtual bool init();
static CCScene *scene();
CREATE_FUNC(GameLayer);
virtual void ccTouchesBegan(CCSet* pTouches, CCEvent* event);
virtual void ccTouchesMoved(CCSet* pTouches, CCEvent* event);
virtual void ccTouchesEnded(CCSet* pTouches, CCEvent* event);
void update (float dt);
};
#endif // __GAMELAYER_H__
消息:
clang: warning: argument unused during compilation: '-websockets'
Undefined symbols for architecture i386:
"GameLayer::ccTouchesBegan(cocos2d::CCSet*, cocos2d::CCEvent*)", referenced from:
vtable for GameLayer in GameLayer.o
"GameLayer::ccTouchesEnded(cocos2d::CCSet*, cocos2d::CCEvent*)", referenced from:
vtable for GameLayer in GameLayer.o
"GameLayer::ccTouchesMoved(cocos2d::CCSet*, cocos2d::CCEvent*)", referenced from:
vtable for GameLayer in GameLayer.o
"GameLayer::update(float)", referenced from:
vtable for GameLayer in GameLayer.o
"non-virtual thunk to GameLayer::ccTouchesBegan(cocos2d::CCSet*, cocos2d::CCEvent*)", referenced from:
vtable for GameLayer in GameLayer.o
"non-virtual thunk to GameLayer::ccTouchesEnded(cocos2d::CCSet*, cocos2d::CCEvent*)", referenced from:
vtable for GameLayer in GameLayer.o
"non-virtual thunk to GameLayer::ccTouchesMoved(cocos2d::CCSet*, cocos2d::CCEvent*)", referenced from:
vtable for GameLayer in GameLayer.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
您沒有在GameLayer.ccp中實現這些功能。 遵循本教程,它將教您如何實現它們。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.