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:
Qt Code:
  1. #ifndef M_H
  2. #define M_H
  3. #include "data.h"
  4.  
  5. #include <QtGlobal>
  6. #include <QString>
  7.  
  8. namespace MYNAMESPACE {
  9. class M : public QObject
  10. {
  11. Q_OBJECT
  12. ....
  13. }
  14. #endif
To copy to clipboard, switch view to plain text mode 

With a corresponding implementation "m.cpp":
Qt Code:
  1. #include "m.h"
  2.  
  3. namespace MYNAMESPACE {
  4. ....
  5. }
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