2014-02-11 1 views
1

답변이 나를 똑바로 쳐다 보지만이 때문에 어떤 진전을 이루지 못했을 것입니다 ... 처음 몇 가지 코드 :<함수 목록> 다중 정의

개체/testObject.h :

#include <irrlicht.h> 
#include "../maths.h" 

using namespace irr; 

#ifndef testObject_H 
#define testObject_H 

class testObject : public scene::SAnimatedMesh 
{ 
    public: 
     testObject(IrrlichtDevice* device); 
     virtual ~testObject(); 
    protected: 
     const char* meshInfoLocation; 
     int totAnims; 
    private: 

}; 

#endif 

개체/testObject.cpp :

#include "testObject.h" 

testObject::testObject(IrrlichtDevice* device) : scene::SAnimatedMesh() 
{ 
    io::IrrXMLReader* modelInformation = io::createIrrXMLReader(meshInfoLocation); 

    while(modelInformation->read()) 
    { 
     if(modelInformation->getNodeName() == "totAnims") totAnims = stringToInt(modelInformation->getAttributeValue("totAnims")); 
    } 
} 

testObject::~testObject() { } //Incomplete, but should still compile... 

내가 생을 컴파일 내가 해결에서 다음을 시도했습니다

/home/david/workspace/spaceSim/objects/testObject.cpp||In constructor ‘testObject::testObject(irr::IrrlichtDevice*)’:| 
/home/david/workspace/spaceSim/objects/testObject.cpp|20|warning: comparison with string literal results in unspecified behaviour [-Waddress]| 
/home/david/workspace/spaceSim/main.cpp||In function ‘int main(int, char**)’:| 
/home/david/workspace/spaceSim/main.cpp|24|warning: ‘virtual bool irr::io::IFileSystem::addZipFileArchive(const c8*, bool, bool)’ is deprecated (declared at /home/david/irrlicht-1.8.1/include/IFileSystem.h:228) [-Wdeprecated-declarations]| 
/home/david/workspace/spaceSim/objects/testObject.cpp||In constructor ‘testObject::testObject(irr::IrrlichtDevice*)’:| 
/home/david/workspace/spaceSim/objects/testObject.cpp|20|warning: comparison with string literal results in unspecified behaviour [-Waddress]| 
obj/Debug/objects/testObject.o||In function `testObject::testObject(irr::IrrlichtDevice*)':| 
/home/david/workspace/spaceSim/objects/testObject.cpp|3|multiple definition of `testObject::testObject(irr::IrrlichtDevice*)'| 
obj/Debug/main.o:/home/david/workspace/spaceSim/objects/testObject.cpp|3|first defined here| 
obj/Debug/objects/testObject.o||In function `testObject::testObject(irr::IrrlichtDevice*)':| 
/home/david/workspace/spaceSim/objects/testObject.cpp|3|multiple definition of `testObject::testObject(irr::IrrlichtDevice*)'| 
obj/Debug/main.o:/home/david/workspace/spaceSim/objects/testObject.cpp|3|first defined here| 
obj/Debug/objects/testObject.o||In function `testObject::~testObject()':| 
/home/david/workspace/spaceSim/objects/testObject.cpp|27|multiple definition of `testObject::~testObject()'| 
obj/Debug/main.o:/home/david/workspace/spaceSim/objects/testObject.cpp|27|first defined here| 
obj/Debug/objects/testObject.o||In function `testObject::~testObject()':| 
/home/david/workspace/spaceSim/objects/testObject.cpp|27|multiple definition of `testObject::~testObject()'| 
obj/Debug/main.o:/home/david/workspace/spaceSim/objects/testObject.cpp|27|first defined here| 
obj/Debug/objects/testObject.o||In function `virtual thunk to testObject::~testObject()':| 
/home/david/workspace/spaceSim/objects/testObject.cpp|29|multiple definition of `virtual thunk to testObject::~testObject()'| 
obj/Debug/main.o:/home/david/workspace/spaceSim/objects/testObject.cpp|29|first defined here| 
obj/Debug/objects/testObject.o||In function `testObject::~testObject()':| 
/home/david/workspace/spaceSim/objects/testObject.cpp|27|multiple definition of `testObject::~testObject()'| 
obj/Debug/main.o:/home/david/workspace/spaceSim/objects/testObject.cpp|27|first defined here| 
obj/Debug/objects/testObject.o||In function `virtual thunk to testObject::~testObject()':| 
/home/david/workspace/spaceSim/objects/testObject.cpp|29|multiple definition of `virtual thunk to testObject::~testObject()'| 
obj/Debug/main.o:/home/david/workspace/spaceSim/objects/testObject.cpp|29|first defined here| 
||=== Build finished: 14 errors, 3 warnings ===| 

:

  • 헤더를 결합하고, CPP 파일의 코드는, 나는 다음과 같은 오류를 얻을.
  • 모든 메서드 본문을 비우고 #include를 제거하여 모든 문제가 클래스 구조가되도록합니다. (운이없는 ...)
  • Google 검색

는 도움을 주셔서 감사합니다!

답변

0

mingw32 (www.mingw.org)의 gcc4.8.1을 사용하여 파일을 컴파일하고 누락 된 유형을 교체하여 코드를 컴파일했습니다. 편집은 괜찮은 것 같습니다. 나는 문제가 될 수도 있겠죠

#include <irrlicht.h> 
#include "../maths.h" 

코드 :

//#include <irrlicht.h> 
//#include "../maths.h" 

//using namespace irr; 

#ifndef testObject_H 
#define testObject_H 
#include <tuple> 
namespace scene { 
    typedef std::tuple<int,int> SAnimatedMesh; 
}; 
typedef int IrrlichtDevice; 

class testObject : public scene::SAnimatedMesh 
{ 
    public: 
     testObject(IrrlichtDevice* device); 
     virtual ~testObject(); 
    protected: 
     const char* meshInfoLocation; 
     int totAnims; 
    private: 

}; 

#endif 

//#include "testObject.h" 

testObject::testObject(IrrlichtDevice* device) : scene::SAnimatedMesh() 
{ 
    /* 
    io::IrrXMLReader* modelInformation = io::createIrrXMLReader(meshInfoLocation); 

    while(modelInformation->read()) 
    { 
     if(modelInformation->getNodeName() == "totAnims") totAnims = stringToInt(modelInformation->getAttributeValue("totAnims")); 
    } 
    */ 
} 

testObject::~testObject() { } //Incomplete, but should still compile... 

int main() {}