How to solve error LNK2001: unresolved external symbol?
-
Hi,
i am beginner of QT. i am using Qt 4.5 library. I try the sample program for OpenGL Examples."i try the following example code like...":http://doc.qt.nokia.com/4.5/opengl-hellogl.html
Once i build this example in my qt, i got some link errors...
like
@lines.obj : error LNK2005: "public: __thiscall GLWidget::GLWidget(class QWidget *)" (??0GLWidget@@QAE@PAVQWidget@@@Z) already defined in GLWidget.obj
1>lines.obj : error LNK2005: "protected: virtual void __thiscall GLWidget::initializeGL(void)" (?initializeGL@GLWidget@@MAEXXZ) already defined in GLWidget.obj
1>GLWidget.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall QGLWidget::~QGLWidget(void)" (_imp??1QGLWidget@@UAE@XZ) referenced in function __unwindfunclet$??0GLWidget@@QAE@PAVQWidget@@@Z$0
1>lines.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall QGLWidget::~QGLWidget(void)" (_imp??1QGLWidget@@UAE@XZ)
1>Main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall QGLWidget::~QGLWidget(void)" (_imp??1QGLWidget@@UAE@XZ)
1>GLWidget.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall QGLWidget::setMouseTracking(bool)" (_imp?setMouseTracking@QGLWidget@@QAEX_N@Z) referenced in function "public: __thiscall GLWidget::GLWidget(class QWidget *)" (??0GLWidget@@QAE@PAVQWidget@@@Z)
1>GLWidget.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QGLWidget::QGLWidget(class QWidget *,class QGLWidget const *,class QFlags<enum Qt::WindowType>)" (_imp??0QGLWidget@@QAE@PAVQWidget@@PBV0@V?$QFlags@W4WindowType@Qt@@@@@Z) referenced in function "public: __thiscall GLWidget::GLWidget(class QWidget *)" (??0GLWidget@@QAE@PAVQWidget@@@Z)
1>lines.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall QGLWidget::QGLWidget(class QWidget *,class QGLWidget const *,class QFlags<enum Qt::WindowType>)" (_imp??0QGLWidget@@QAE@PAVQWidget@@PBV0@V?$QFlags@W4WindowType@Qt@@@@@Z)
1>GLWidget.obj : error LNK2001: unresolved external symbol "protected: virtual bool __thiscall QGLWidget::event(class QEvent *)" (?event@QGLWidget@@MAE_NPAVQEvent@@@Z)
1>lines.obj : error LNK2001: unresolved external symbol "protected: virtual bool __thiscall QGLWidget::event(class QEvent *)" (?event@QGLWidget@@MAE_NPAVQEvent@@@Z)
1>GLWidget.obj : error LNK2019: unresolved external symbol __imp__glEnable@4 referenced in function "protected: virtual void __thiscall GLWidget::initializeGL(void)" (?initializeGL@GLWidget@@MAEXXZ)
@How to solve this error?
Thanks
M.Mathi -
Try to clean project and review your meta-information.