【发布时间】:2014-11-05 01:29:32
【问题描述】:
我正在尝试在 Yosemite 上配置 QTCreator 和 SFML,已经遇到了一个相当令人不快的问题,最低版本设置为 OS X 10.6(现在设置为 OS X 10.9),现在我遇到了“问题”架构 x86_64' 的未定义符号,这是 QTCreator 的应用程序输出:
Undefined symbols for architecture x86_64:
"PlayMapAI::m_PlayMapAI", referenced from:
PlayMapAI::instance() in MenuState.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [framework] Error 1
23:23:14: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project framework (kit: Desktop Qt 5.3 clang 64bit)
When executing step "Make"
下面是它运行的选项:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -std=c++11 -Wno-ignored-qualifiers -g -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -mmacosx-version-min=10.9 -Wall -W -fPIE -I/Applications/QT/5.3/clang_64/mkspecs/macx-clang -I../qtcreator -I../../include -I../../include/tinyxml -I../../include/tmxloader -I/usr/local/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/AGL.framework/Headers -I. -o PlayState.o ../../source/PlayState.cpp
有什么建议吗?
-- 更新
这是 PlayMapAI.h 文件(没有任何 .cpp 文件):
#ifndef PLAY_MAPAI_H_
#define PLAY_MAPAI_H_
#include <list>
#include <string>
#include "GameState.h"
#include "Sprite.h"
#include "InputManager.h"
#include <MapLoader.h>
struct Kinematic
{
cgf::Sprite* sprite;
sf::Vector3f pos;
sf::Vector3f vel;
sf::Vector3f heading;
float maxForce;
float maxSpeed;
float maxTurnRate;
};
class PlayMapAI : public cgf::GameState
{
public:
void init();
void cleanup();
void pause();
void resume();
void handleEvents(cgf::Game* game);
void update(cgf::Game* game);
void draw(cgf::Game* game);
// Implement Singleton Pattern
static PlayMapAI* instance()
{
return &m_PlayMapAI;
}
protected:
PlayMapAI() {}
private:
static PlayMapAI m_PlayMapAI;
int x, y;
float speed; // player speed
float zvel;
cgf::Sprite player;
cgf::Sprite ghost;
sf::RenderWindow* screen;
std::list<sf::Vector3f> trail;
bool showTrails;
Kinematic playerK, enemyK;
cgf::InputManager* im;
sf::Font font;
sf::Text text;
tmx::MapLoader* map;
bool firstTime;
bool checkCollision(uint8_t layer, cgf::Game* game, Kinematic& obj);
void centerMapOnPlayer();
sf::Uint16 getCellFromMap(uint8_t layernum, float x, float y);
enum {
CHASE_BEHAVIOR=0, ARRIVE_BEHAVIOR, PURSUIT_BEHAVIOR, FLEE_BEHAVIOR, EVADE_BEHAVIOR
};
const static std::string modes[];
int steerMode;
sf::Vector3f chase(Kinematic& vehicle, sf::Vector3f& target); // ir diretamente ao jogador
sf::Vector3f arrive(Kinematic& vehicle, sf::Vector3f& target, float decel=0.2); // ir diretamente ao jogador
sf::Vector3f pursuit(Kinematic& vehicle, Kinematic& target); // perseguir o jogador, prevendo a posição futura
sf::Vector3f flee(Kinematic& vehicle, sf::Vector3f& target, float panicDistance=100); // fugir do jogador
sf::Vector3f evade(Kinematic& vehicle, Kinematic& target);
};
#endif
【问题讨论】:
-
抱歉没明白上面问题的重点,是不是和静态声明有关?
标签: qt-creator sfml