PDA

View Full Version : Linking problems with files containing QWT code



sacrif
3rd December 2009, 12:25
Hi,

I am not sure whether it is directly a QWT problem, however for me it occures in that context. And since I dont know where else to post I will try it here:

I created a project in VS2008 using a cmake file. And as soon as I add QWT code the linker errors at the end of this post occure.
I assume it is somehow related to a missing QWT library. I added the library directory in the project properties of Visual Studio, but it does not seem to help. Maybe someone else has an idea.

Reagards

2>Linking...
2> Creating library C:\Alpha_Histogram_Installed\Debug\dgTest.lib and object C:\Diplomarbeit\Alpha_Histogram_Installed\Debug\dg Test.exp
2>histogram_item.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall QwtPlotItem::~QwtPlotItem(void)" (??1QwtPlotItem@@UAE@XZ) referenced in function "public: virtual __thiscall HistogramItem::~HistogramItem(void)" (??1HistogramItem@@UAE@XZ)
2>histogram_item.obj : error LNK2019: unresolved external symbol "public: __thiscall QwtPlotItem::QwtPlotItem(class QwtText const &)" (??0QwtPlotItem@@QAE@ABVQwtText@@@Z) referenced in function "public: __thiscall HistogramItem::HistogramItem(class QwtText const &)" (??0HistogramItem@@QAE@ABVQwtText@@@Z)
2>histogram_item.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall QwtPlotItem::updateLegend(class QwtLegend *)const " (?updateLegend@QwtPlotItem@@UBEXPAVQwtLegend@@@Z)
2>histogram_item.obj : error LNK2001: unresolved external symbol "public: virtual class QWidget * __thiscall QwtPlotItem::legendItem(void)const " (?legendItem@QwtPlotItem@@UBEPAVQWidget@@XZ)
2>histogram_item.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall QwtPlotItem::setVisible(bool)" (?setVisible@QwtPlotItem@@UAEX_N@Z)
2>histogram_item.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall QwtPlotItem::itemChanged(void)" (?itemChanged@QwtPlotItem@@UAEXXZ)
2>histogram_item.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall QwtPlotItem::updateScaleDiv(class QwtScaleDiv const &,class QwtScaleDiv const &)" (?updateScaleDiv@QwtPlotItem@@UAEXABVQwtScaleDiv@@ 0@Z)
2>histogram_item.obj : error LNK2019: unresolved external symbol "public: __thiscall QwtText::~QwtText(void)" (??1QwtText@@QAE@XZ) referenced in function "public: __thiscall HistogramItem::HistogramItem(class QString const &)" (??0HistogramItem@@QAE@ABVQString@@@Z)
2>histogram_item.obj : error LNK2019: unresolved external symbol "public: __thiscall QwtText::QwtText(class QString const &,enum QwtText::TextFormat)" (??0QwtText@@QAE@ABVQString@@W4TextFormat@0@@Z) referenced in function "public: __thiscall HistogramItem::HistogramItem(class QString const &)" (??0HistogramItem@@QAE@ABVQString@@@Z)
2>histogram_item.obj : error LNK2019: unresolved external symbol "public: __thiscall QwtIntervalData::~QwtIntervalData(void)" (??1QwtIntervalData@@QAE@XZ) referenced in function "public: __thiscall HistogramItem::PrivateData::~PrivateData(void)" (??1PrivateData@HistogramItem@@QAE@XZ)
2>histogram_item.obj : error LNK2019: unresolved external symbol "public: void __thiscall QwtPlotItem::setZ(double)" (?setZ@QwtPlotItem@@QAEXN@Z) referenced in function "private: void __thiscall HistogramItem::init(void)" (?init@HistogramItem@@AAEXXZ)
2>histogram_item.obj : error LNK2019: unresolved external symbol "public: void __thiscall QwtPlotItem::setItemAttribute(enum QwtPlotItem::ItemAttribute,bool)" (?setItemAttribute@QwtPlotItem@@QAEXW4ItemAttribut e@1@_N@Z) referenced in function "private: void __thiscall HistogramItem::init(void)" (?init@HistogramItem@@AAEXXZ)
2>histogram_item.obj : error LNK2019: unresolved external symbol "public: __thiscall QwtIntervalData::QwtIntervalData(void)" (??0QwtIntervalData@@QAE@XZ) referenced in function "public: __thiscall HistogramItem::PrivateData::PrivateData(void)" (??0PrivateData@HistogramItem@@QAE@XZ)
2>histogram_item.obj : error LNK2019: unresolved external symbol "public: class QRectF __thiscall QwtIntervalData::boundingRect(void)const " (?boundingRect@QwtIntervalData@@QBE?AVQRectF@@XZ) referenced in function "public: virtual class QRectF __thiscall HistogramItem::boundingRect(void)const " (?boundingRect@HistogramItem@@UBE?AVQRectF@@XZ)
2>histogram_item.obj : error LNK2019: unresolved external symbol "public: static void __cdecl QwtPainter::drawLine(class QPainter *,int,int,int,int)" (?drawLine@QwtPainter@@SAXPAVQPainter@@HHHH@Z) referenced in function "protected: virtual void __thiscall HistogramItem::drawBar(class QPainter *,enum Qt::Orientation,class QRect const &)const " (?drawBar@HistogramItem@@MBEXPAVQPainter@@W4Orient ation@Qt@@ABVQRect@@@Z)
2>histogram_item.obj : error LNK2019: unresolved external symbol "public: static void __cdecl QwtPainter::drawRect(class QPainter *,int,int,int,int)" (?drawRect@QwtPainter@@SAXPAVQPainter@@HHHH@Z) referenced in function "protected: virtual void __thiscall HistogramItem::drawBar(class QPainter *,enum Qt::Orientation,class QRect const &)const " (?drawBar@HistogramItem@@MBEXPAVQPainter@@W4Orient ation@Qt@@ABVQRect@@@Z)
2>C:\Alpha_Histogram_Installed\Debug\dgTest.exe : fatal error LNK1120: 16 unresolved externals
2>Build log was saved at "file://c:\Alpha_Histogram_Installed\dgTest.dir\Debug\Buil dLog.htm"
2>dgTest - 17 error(s), 3 warning(s)
3>------ Skipped Build: Project: ALL_BUILD, Configuration: Debug Win32 ------
3>Project not selected to build for this solution configuration
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 1 skipped ==========

wysota
3rd December 2009, 12:33
It's not that simple. You have to link to the library itself.

sacrif
3rd December 2009, 13:09
Could you please explain that in more detail?

I already build the qwt library, and the test examples included do also work.
Howerver as soon as I try to include QWT code in my project the errors shown above occur.
Moreover usual Qt code does also work. Is it probably necessary to add additional code in the .cmake file to add qwt as well?

Maybe you can tell me what else needs to be done, or where I can find closer Information.

Thanks and Regards

wysota
3rd December 2009, 13:26
Could you please explain that in more detail?
Come on, man... you do know what a dynamically linked library is, right? I'm sure if you search the forum, you will find an answer to your problem. Especially that I just answered a very similar question in another thread. You can join forces looking for the answer.

sacrif
3rd December 2009, 14:18
I am sorry to bother you with low level questions, but I am completly new to all these tools and am a little overstrained atm:/ But I think thats what the Newbie forum is for.

I know what a dll is, but I I still don't know how I can link it to my project, or what exactly the problem is. Is it possible that the problem lies in missing details in the .cmake file?
Sorry again for the newbish questions, but maybe someone can still give me an idea what to do, or a link to related topic.

Thanks

wysota
3rd December 2009, 14:23
I am sorry to bother you with low level questions, but I am completly new to all these tools and am a little overstrained atm:/ But I think thats what the Newbie forum is for.
This is a newbie forum for Qt programmers, not to newbie programmers at all.

I won't tell you how to do it with cmake as I don't use cmake myself, for qmake you have to tell it to link your application against the library by changing the LIBS variable.

area51
8th December 2009, 12:49
Just take a look at "target_link_libraries" in the cmake documentation...

ChrisW67
11th December 2009, 05:01
Have a look at the snippet from a .pro file that links to Qwt for a hint:
http://www.qtcentre.org/forum/f-newbie-4/t-qtcrypto-problem-26366.html