Qt-interest Archive, May 2008
Trouble with Qt Eclipse Integration and QT_BEGIN_NAMESPACE
Message 1 in thread
Hi everyone,
I use QT 4.4.0 with the Qt Eclipse Integration v1.4.0.
After setting up a Qt Project and Eclipse I imported the system tray example,
but I am unable to compile it due to the following errors in the file window.h:
error in line 51: expected constructor, destructor, or type conversion before ‘class’
error in line 64: expected constructor, destructor, or type conversion before ‘class’
Here are the relevant lines of code from the example (window.h):
47: #include <QSystemTrayIcon>
48: #include <QDialog>
49:
50: QT_BEGIN_NAMESPACE
51: class QAction;
52: class QCheckBox;
53: class QComboBox;
54: class QGroupBox;
55: class QLabel;
56: class QLineEdit;
57: class QMenu;
58: class QPushButton;
59: class QSpinBox;
60: class QTextEdit;
61: QT_END_NAMESPACE
62:
63: //! [0]
64: class Window : public QDialog
65: {
When I delete QT_BEGIN_NAMESPACE and QT_END_NAMESPACE, window.h will compile fine,
but window.c will get several "multiple definition" errors. I guess this is due to
namespace conflicts. It seems to me that the Eclipse Integration Plugin doesn't
know what to do with QT_BEGIN_NAMESPACE and QT_END_NAMESPACE.
I'd be grateful if someone could point me to the right direction, because I couldn't
resolve this issue.
Thanks in advance,
Simon
--
[ signature omitted ]