[vtkusers] Static Link VTK
Mehdi Esteghamatian
mehdiesteghamat at gmail.com
Mon Dec 10 00:59:10 EST 2012
Yes your right it should be fine although I am not getting it right yet. My
previous qt was compiled dynamically. So, I still had to put QT dlls in the
target folder.
Now I compiled the qt statically which is a bit confusing because It did
not create separate folders for statics and dynamic libraries, so now
things look like below in lib folder (D:\...\QT\4.8.4\lib). For every
library I have 4 versions. for example for QTCore I have the followings
QtCore.lib -> static release
QtCored.lib -> static debug
QtCore.lib -> dynamic rlease
QtCore.lib -> dynamic debug
*NOW *the problem is that I am getting redefinition link errors as below
which is probably because Visual Studio (2010) still tries to compile the
target dynamically which should no longer be the case.
I guess I need to somehow tell the VS to stick to static libraries only
either directly or through CMakeLists.txt (which I am not good at).
Please let me know if there is any suggestions.
Regards,
Mehdi
1>------ Build started: Project: SimpleView, Configuration: Debug Win32
------
1>QtGuid4.lib(QtGuid4.dll) : error LNK2005: "public: __thiscall
QSizePolicy::QSizePolicy(enum QSizePolicy::Policy,enum
QSizePolicy::Policy)" (??0QSizePolicy@@QAE at W4Policy@0 at 0@Z) already defined
in SimpleView.obj
1>QtCored4.lib(QtCored4.dll) : error LNK2005: "public: __thiscall
QString::~QString(void)" (??1QString@@QAE at XZ) already defined in
SimpleView.obj
1>QtCored4.lib(QtCored4.dll) : error LNK2005: "public: int __thiscall
QSize::width(void)const " (?width at QSize@@QBEHXZ) already defined in
SimpleView.obj
1>QtCored4.lib(QtCored4.dll) : error LNK2005: "public: int __thiscall
QSize::height(void)const " (?height at QSize@@QBEHXZ) already defined in
SimpleView.obj
1>QtCored4.lib(QtCored4.dll) : error LNK2005: "public: bool __thiscall
QBasicAtomicInt::deref(void)" (?deref at QBasicAtomicInt@@QAE_NXZ) already
defined in SimpleView.obj
1>SimpleView.obj : error LNK2001: unresolved external symbol "private:
static class QCoreApplication * QCoreApplication::self"
(?self at QCoreApplication@@0PAV1 at A)
1>moc_SimpleView.obj : error LNK2001: unresolved external symbol "public:
static struct QMetaObject const QMainWindow::staticMetaObject"
(?staticMetaObject at QMainWindow@@2UQMetaObject@@B)
1>D:\Research\SampleCodes\SimpleView\winbin\Debug\SimpleView.exe : fatal
error LNK1120: 2 unresolved externals
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========
On Sun, Dec 9, 2012 at 8:29 PM, John Drescher <drescherjm at gmail.com> wrote:
> >> Yes I already did that but the thing is that I am using QT as well for
> GUI
> >> stuff and as I turn off BUILD_SHARED_LIBS it dose not compile QVTK.lib
> which
> >> I guess it is because the my QT was compiled dynamically.
>
> QVTK.lib will work fine without shared libraries. I have been using
> that this way for over 4 years (up to vtk-5.10.0 and Qt-4.8.4).
>
> John
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20121210/46a92469/attachment.htm>
More information about the vtkusers
mailing list