I am trying to use the following c++ class in a Qt application
header:
//-----------------------------------------------------------------------------
#pragma once
#include <qtabwidget.h>
class EditorTabBar : public QTabWidget
{
Q_OBJECT
public:
EditorTabBar( QWidget * ip_parent );
};
//-----------------------------------------------------------------------------
source:
//-----------------------------------------------------------------------------
#include "EditorTabBar.h"
EditorTabBar::EditorTabBar(QWidget* ip_parent):
QTabWidget(ip_parent, 0, 0)
{
}
//-----------------------------------------------------------------------------
If I compile this code, visual studio gives the following errors:
EditorTabBar.h(19) : error C2460: 'EditorTabBar::QWidget*ip_parent' : uses 'EditorTabBar', which is being defined
EditorTabBar.h(14) : see declaration of 'EditorTabBar'
EditorTabBar.cpp(12) : error C3209: 'ip_parent' : Unicode identifiers are not yet supported
EditorTabBar.cpp(12) : error C2511: 'EditorTabBar::EditorTabBar(QWidget *)' : overloaded member function not found in 'EditorTabBar'
EditorTabBar.h(14) : see declaration of 'EditorTabBar'
EditorTabBar.cpp(18) : fatal error C1004: unexpected end of file found
First I posted this question on qtforum.org, but there someone suggested this is probably not something Qt specific. Still I find it strange that the compiler complains about 'EditorTabBar::QWidget*ip_parent' while the code should be 'EditorTabBar(QWidget * ip_parent)'. Since the moc preprocesses header files, I suspected this might be the cause... Sometimes similar classes (inheriting from QObject, QWidget,...) do compile after playing a bit with whitespaces and 'layout' of the source code. Anyone a clue about what goes wrong?
Thanks.