I'm having a lot of 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. To be able to use the slots and signals, I made this class, which before compiled normally, into a QObject. 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 of multiple definitions (289 in total). Remembering that MYClass is a shortened version of the PlatefinderController class. The errors look a lot like this below, but the compiler output with the 289 errors can be seen at: link
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 avoid this?