나는 간단한 게임 엔진을 쓰고 있어요 연결을 찾을 수 없습니다, 그리고 나는 EntityComponent.h 파일이 있습니다기호 라이브러리
#include "EntityComponent.h"
#include <string>
psycho2d::EntityComponent::EntityComponent(const std::string &name){
this->m_name = name;
}
psycho2d::EntityComponent::~EntityComponent(){}
inline const std::string& psycho2d::EntityComponent::getName() const{
return this->m_name;
}
이를 :
#ifndef Psycho2D_Core_EntityComponent_
#define Psycho2D_Core_EntityComponent_
#include <string>
namespace psycho2d{
class EntityComponent{
private:
std::string m_name;
public:
EntityComponent(const std::string &name);
virtual ~EntityComponent();
const std::string& getName() const;
virtual void initialize() = 0;
virtual void loadProperties() = 0;
virtual void update() = 0;
virtual void destroy() = 0;
};
}
#endif
그리고 상대 EntityComponent.cpp 파일을 두 파일은 프레임 워크의 일부입니다 (저는 Mac에서 작업 중입니다). 그들은 잘 컴파일됩니다. 문제는 라이브러리를 사용하는 실행 파일을 작성할 때입니다. EntityComponent의 하위 클래스를 만들고 컴파일했습니다. 나는 getName() 함수를 호출한다면, 링커는 말해 :
"psycho2d::EntityComponent::getName() const", referenced from:
_main in main.o
Symbol(s) not found
Collect2: ld returned 1 exit status
내가 할 수있는 무엇? 감사합니다. .
지정 구현 된 적이 있습니까? –
컴파일/링크 명령을 포함하면 도움이 될 수 있습니다. –