If I include #include "ARToolKitPlus/TrackerSingleMarkerImpl.h" in a simple file, main.cpp, work perfect.
but if I include #include "ARToolKitPlus/TrackerSingleMarkerImpl.h" in other header, for example CGame.h, not work.
¿what's the problem?
.objs\main.o:main.cpp:(.text+0x3b2e): multiple definition of `ARToolKitPlus::CameraImpl::CameraImpl()'
.objs\VideoAR.o:VideoAR.cpp:(.text+0x3a30): first defined here
.objs\main.o:main.cpp:(.text+0x3b4a): multiple definition of `ARToolKitPlus::CameraImpl::CameraImpl()'
.objs\VideoAR.o:VideoAR.cpp:(.text+0x3a4c): first defined here
.....
a little of c++
It seems that TrackerSingleMarkerImpl.h does not contain pre-compiler-directives to prevent the file from being included more than once in a given source-file.
Most probably you've included this header in VideoAR and have included both VideoAR as well as TSMI.h in your main. The result is that TSMI.h is included twice in main in the end, and thus those defenitions are duplicated.
Here's the code-concept to fix this kind of error.
code of someheader.h
This will prevent the definitions of the headerfile to be included more than once in your project, and thus prevent the compilererror you're getting.
[EDIT]
On a sidenote: this is far from an advanced question imo, but rather the basics of correct understanding of classes and compilation. I'd advise you to go and learn more about Classes, if not, you'll probably have a rather hard time starting to work with irrlicht.
Just my 2c
[/EDIT]
Most probably you've included this header in VideoAR and have included both VideoAR as well as TSMI.h in your main. The result is that TSMI.h is included twice in main in the end, and thus those defenitions are duplicated.
Here's the code-concept to fix this kind of error.
code of someheader.h
Code: Select all
#ifndef SOMEHEADER_H
#define SOMEHEADER_H
//here comes all the code of the header as always
#endif SOMEHEADER_H
[EDIT]
On a sidenote: this is far from an advanced question imo, but rather the basics of correct understanding of classes and compilation. I'd advise you to go and learn more about Classes, if not, you'll probably have a rather hard time starting to work with irrlicht.
Just my 2c
[/EDIT]