0
I’m having many Multiple Definitions problems in QT. For common classes, and all classes in our library, the solution was to put the header and implementation in the same . hpp, and it worked. In order to use the slots and Signals, I transformed this class, which I used to compile normally, into a Qobject. Staying, briefly, with this format:
#ifndef MYCLASS_HPP
#define MYCLASS_HPP
#include "common.hpp"
#include <qtGui>
namespace Bial
{
class Image;
class Myclass : QObject{
Image *img;
signal:
void mySignal();
public:
void f();
}
//Implementação;
#include "Image.hpp"
namespace Bial{
void Myclass::f(){
}
}
#endif //MYCLASS_HPP
However, when compiling this program I get many errors from Multiple Definitions (289 in total). Remember that Myclass is a short version of the Platefindercontroller class. The errors look a lot like this one below, but the compiler output, with the 289 errors can be seen in : http://pastebin.com/L9cx7hv9
Platefindercontroller. o: In Function Bial::PlatefinderController::NextGroup()':
/home/lellis/Dropbox/Lellis_Diet/bin/../diet/inc/PlatefinderController.hpp:103: multiple definition of
Bial::Platefindercontroller::Nextgroup()'
mainwindow. o:/home/Lellis/Dropbox/Lellis_diet/bin/.. /diet/inc/Platefindercontroller.hpp:103: first defined here
Is there anything I can do to prevent this?