[vtkusers] Static Link VTK
Mehdi Esteghamatian
mehdiesteghamat at gmail.com
Mon Dec 10 21:06:14 EST 2012
Dear Alex,
Thanks for the response. I did not know about CRTs I am not too sure it can
affect the static compilations.
Is it recommended for Win32 machines because I am running it on Vista and
MSVC 2010.
I will probably clean up everthing do it again see if I can understand what
is going on :)
Cheers,
Mehdi
On Mon, Dec 10, 2012 at 7:05 PM, Alex Malyushytskyy <alexmalvtk at gmail.com>wrote:
> Possible problem - "Static" Qt build is mostly likely using CRT dlls
> unless you manually edited project options. This means you can't link
> static VTK (using static CRTs with suck Qt). In fact you still have to
> link VTK as dlls.
>
> I do no think nice solution exists. Some people claim that they were
> able to link Qt vs static CRTs. I personally tried this hard with Qt
> 4.5
> and even though my application was running I had some problems with
> some cases ( from the top of my head setting specific item in combobox
> was giving access violation)
>
> But if you manage to do this and would not have any problem with Qt
> you can build static version of vtk and you will get wehat you want.
> Otherwise all you can get rid of - Qt dlls. Even though QT is build as
> 'static' libraries it will be linked against dynamic CRTs which will
> force you to provide such CRTs as dependencies and unless you can link
> static VTK vs dynamic CRTS ( I am not sure how easy is it) you will
> have to build vtk as dlls.
>
> Alex
>
> On Mon, Dec 10, 2012 at 7:07 AM, Mehdi Esteghamatian
> <mehdiesteghamat at gmail.com> wrote:
> > Yes many times.
> >
> > On Mon, Dec 10, 2012 at 8:54 AM, John Drescher <drescherjm at gmail.com>
> wrote:
> >>
> >> On Mon, Dec 10, 2012 at 12:59 AM, Mehdi Esteghamatian
> >> <mehdiesteghamat at gmail.com> wrote:
> >> > 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
> >> > ==========
> >>
> >> Did you clean you build and also regenerate the visual studio solution
> >> using CMake-gui?
> >>
> >> John
> >
> >
> >
> > _______________________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> >
> > Please keep messages on-topic and check the VTK FAQ at:
> > http://www.vtk.org/Wiki/VTK_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtkusers
> >
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20121210/c140c6a2/attachment.htm>
More information about the vtkusers
mailing list