I am trying to compile a Qt example about popup widget (
http://doc.trolltech.com/3.3/popup-example.html), but get some LNK2001 errors (see below). I use .NET 2003 integrated compiler and have added the moc step to my header file.
--------------------------
----------
----------
----------
----------
----------
-
Header file:
#ifndef TEST_POPUP_H_
#define TEST_POPUP_H_
#include <QtWidgets/common.h>
#include <qwidget.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qlineedit.h>
class TIQTPLUGINS_DECL TestPopup : public QLabel {
Q_OBJECT
public:
TestPopup( QWidget* parent = 0, const char* name = 0 );
void popup( QWidget* parent = 0);
protected:
virtual void mouseMoveEvent( QMouseEvent * );
virtual void mouseReleaseEvent( QMouseEvent * );
virtual void closeEvent( QCloseEvent * );
private:
QWidget* popupParent;
int moves;
};
class TIQTPLUGINS_DECL Frame : public QFrame
{
Q_OBJECT
public:
Frame( QWidget *parent=0, const char* name = 0 );
protected:
private slots:
void button1Clicked();
void button2Pressed();
private:
QPushButton *button1;
QPushButton *button2;
QFrame* popup1;
TestPopup* popup2;
};
#endif
--------------------------
----------
----------
----------
----------
----------
--------
Link errors:
------ Rebuild All started: Project: TiWidgets, Configuration: Debug Win32 ------
Deleting intermediate files and output files for project 'TiWidgets', configuration 'Debug|Win32'.
Moc'ing test_popup.h...
Moc'ing distribution_selector.h...
Compiling...
moc_distribution_selector.
cpp
Compiling...
test_popup.cpp
Compiling...
ti_widgets_plugin.cpp
ti_widgets_plugin.cpp(25) : warning C4100: 'key' : unreferenced formal parameter
ti_widgets_plugin.cpp(35) : warning C4100: 'key' : unreferenced formal parameter
ti_widgets_plugin.cpp(54) : warning C4100: 'key' : unreferenced formal parameter
Compiling...
ti_qtAccessors.cpp
c:\GsTL\GsTLAppli\GsTLAppl
i\gui\util
s\qwidget_
value_acce
ssor.h(53)
: warning C4100: 'widget' : unreferenced formal parameter
c:\GsTL\GsTLAppli\GsTLAppl
i\utils\gs
tl_message
s_private.
h(206) : warning C4251: 'Channel::scribes_' : class 'std::list<_Ty>' needs to have dll-interface to be used by clients of class 'Channel'
with
[
_Ty=SmartPtr<Scribe>
]
Compiling...
distribution_selector.cpp
Linking...
Creating library c:\gstl\GsTLAppli\lib\win3
2\debug\Ti
Widgets.li
b and object c:\gstl\GsTLAppli\lib\win3
2\debug\Ti
Widgets.ex
p
test_popup1.obj : error LNK2019: unresolved external symbol "public: static class QMetaObject * __cdecl TestPopup::staticMetaObjec
t(void)" (?staticMetaObject@TestPop
up@@SAPAVQ
MetaObject
@@XZ) referenced in function "public: virtual class QMetaObject * __thiscall TestPopup::metaObject(void
)const " (?metaObject@TestPopup@@UB
EPAVQMetaO
bject@@XZ)
test_popup1.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall TestPopup::qt_property(int
,int,class
QVariant *)" (?qt_property@TestPopup@@U
AE_NHHPAVQ
Variant@@@
Z)
test_popup1.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall TestPopup::qt_emit(int,str
uct QUObject *)" (?qt_emit@TestPopup@@UAE_N
HPAUQUObje
ct@@@Z)
test_popup1.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall TestPopup::qt_invoke(int,s
truct QUObject *)" (?qt_invoke@TestPopup@@UAE
_NHPAUQUOb
ject@@@Z)
test_popup1.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall TestPopup::qt_cast(char const *)" (?qt_cast@TestPopup@@UAEPA
XPBD@Z)
test_popup1.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall TestPopup::className(void)
const " (?className@TestPopup@@UBE
PBDXZ)
test_popup1.obj : error LNK2019: unresolved external symbol "public: static class QMetaObject * __cdecl Frame::staticMetaObject(vo
id)" (?staticMetaObject@Frame@@
SAPAVQMeta
Object@@XZ
) referenced in function "public: virtual class QMetaObject * __thiscall Frame::metaObject(void)con
st " (?metaObject@Frame@@UBEPAV
QMetaObjec
t@@XZ)
test_popup1.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall Frame::qt_property(int,int
,class QVariant *)" (?qt_property@Frame@@UAE_N
HHPAVQVari
ant@@@Z)
test_popup1.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall Frame::qt_emit(int,struct QUObject *)" (?qt_emit@Frame@@UAE_NHPAU
QUObject@@
@Z)
test_popup1.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall Frame::qt_invoke(int,struc
t QUObject *)" (?qt_invoke@Frame@@UAE_NHP
AUQUObject
@@@Z)
test_popup1.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall Frame::qt_cast(char const *)" (?qt_cast@Frame@@UAEPAXPBD
@Z)
test_popup1.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall Frame::className(void)cons
t " (?className@Frame@@UBEPBDX
Z)
c:\gstl\GsTLAppli\lib\win3
2\debug\Ti
Widgets.dl
l : fatal error LNK1120: 12 unresolved externals
Build log was saved at "file://c:\GsTL\Ti_Program
\QtWidgets
\Debug\Bui
ldLog.htm"
TiWidgets - 13 error(s), 5 warning(s)
---------------------- Done ----------------------
Rebuild All: 0 succeeded, 1 failed, 0 skipped
--------------------------
----------
----------
--------
Appreciate your help.