Hello all,
I'm having problems compiling my code under Linux using Qt Creator (Qt 4.6).
In particular, I have a header file "m.h" like the following:
#ifndef M_H
#define M_H
#include "data.h"
#include <QtGlobal>
#include <QString>
namespace MYNAMESPACE {
{
Q_OBJECT
....
}
#endif
#ifndef M_H
#define M_H
#include "data.h"
#include <QtGlobal>
#include <QString>
namespace MYNAMESPACE {
class M : public QObject
{
Q_OBJECT
....
}
#endif
To copy to clipboard, switch view to plain text mode
With a corresponding implementation "m.cpp":
#include "m.h"
namespace MYNAMESPACE {
....
}
#include "m.h"
namespace MYNAMESPACE {
....
}
To copy to clipboard, switch view to plain text mode
data.h contains constants and helper functions, and also includes QtGlobal and QString.
Now, when I try to compile this, I get errors like these:
m.o: In function M:
[path to qtglobal.h]/qtglobal.h: 1361: multiple definition of `MYNAMESPACE::M::M()'
[path to qtglobal.h]/qtglobal.h: 1361: first defined here
It then proceeds to complain that every single function in m.cpp is already defined in m.cpp (identical line numbers).
I have no idea whatsoever. Why would it claim that my own function/class is previously defined in qtglobal.h, I am even using my own namespace? And then, why do I get errors that complain that a method defined in one file was perviously defined in the same file? This error repeats through my entire program with all functions that I have written. Is it wrong to include QtGlobal or what am I missing?
I think I also should mention that I get a lot of warnings about my Makefile that look like this:
Makefile:[line number]: warning: ignoring old commands for target 'moc_m.cpp'
Makefile:[line number]: warning: ignoring old commands for target 'm.o'
Any help would be greatly appreciated.
Thanks,
Stephan
Bookmarks