[Insight-users] Qt + Itk + Cmake = Problem
Luis Ibanez
luis.ibanez at kitware.com
Thu Sep 8 21:05:56 EDT 2005
Hi Philipp
I missed from your email:
What version of CMake are you using ?
Also, when you attempt to build QtITK, are you
doing this as part of the full build of InsightApplications ?
or you are doing it by running CMake directly in that
source subdirectory ?
From your description, you seem to be missing the include
paths for the basic ITK classes....
Also,...
are you using the FindQT.cmake from the Modules in CMake ?
(this will depend on your answer the the CMake version question).
Thanks
Luis
-------------------------
Rainbowfrog at web.de wrote:
> Hello
>
> I get a problem with my current project when I try to put together QT and ITK. I have taken a look at the QTITK example in the "Insight Applications", but I don't get this one working either.
> About QT, I have given Cmake the following paths:
>
> QT_INCLUDE_DIR C:/Qt/3.3.3Educational/include
> QT_MOC_EXECUTABLE C:/Qt/3.3.3Educational/bin/moc.exe
> QT_QASSISTANTCLIENT_LIBRARY C:/Qt/3.3.3Educational/lib/qassistantclient.lib
> QT_QTMAIN_LIBRARY C:/Qt/3.3.3Educational/lib/qtmain.lib
> QT_QT_LIBRARY C:/Qt/3.3.3Educational/lib/qt-mtedu333.lib
> QT_UIC_EXECUTABLE C:/Qt/3.3.3Educational/bin/uic.exe
>
> If I'm trying to build the QTITK example or my own project , in both cases CMake doesn't find the QT_QT_LIBRARY at the beginning, but if I then provide it I don't get further error messages from Cmake. But after configuring with CMake, when I open the project in visual studio and try build it, I get errors.
> In the case of the QTITK Example I get:
>
> D:\Studium\InsightApplications-2.0.1\InsightApplications-2.0.1\QtITK\itkQtProgressBar.cxx(20) : fatal error C1083: Include-Datei kann nicht geoeffnet werden: 'itkProcessObject.h': No such file or directory
> qtITK.cxx
> D:\Studium\InsightApplications-2.0.1\InsightApplications-2.0.1\QtITK\qtITK.cxx(24) : fatal error C1083: Include-Datei kann nicht geoeffnet werden: 'itkImage.h': No such file or directory
> moc_itkQtAdaptor.cxx
> D:\Studium\InsightApplications-2.0.1\InsightApplications-2.0.1\QtITK\itkQtAdaptor.h(21) : fatal error C1083: Include-Datei kann nicht geoeffnet werden: 'itkObject.h': No such file or directory
> moc_itkQtLightIndicator.cxx
> D:\Studium\InsightApplications-2.0.1\InsightApplications-2.0.1\QtITK\itkQtLightIndicator.h(3) : fatal error C1083: Include-Datei kann nicht geoeffnet werden: 'itkCommand.h': No such file or directory
> Generieren von Code...
>
> ("Include-Datei kann nicht geoeffnet werden" means that the include file couldn't be opened). I don't know why this happens, I didn't modify anything the CmakeLists.txt or sourcecode of the example, and since it's an example it's unlikely that something is wrong with it.
> The same with my small project: so far I don't have any ITK commands in it, and as long as I used qmake to create the makefiles, everything was working. But from now on I'll need Itk to do some segmentation and so I tried to use CMake to put ITK and Qt together.
> My own project consists of 7 files so far:
> PictureData.h
> PictureData.cxx
> PicWidget.h
> PicWidget.cxx
> PicDisplay.h
> PicDisplay.cxx
> main.cxx
>
>
>
> For the CMakeLists.txt file (see below) I have put something together from what I have seen in the QtItk Example. I don't know if it is correct like this, especially I wonder if it can be correct that I don't refer to the header files anywhere in this CMakeLists file. What would the correct CMakeLists file for my example look like / what do the correct CMakeLists-commands depend on in my case ?
> I used this one:
>
>
> PROJECT(SegmItk1)
>
> FIND_PACKAGE(ITK)
> IF(ITK_FOUND)
> INCLUDE(${ITK_USE_FILE})
> ELSE(ITK_FOUND)
> MESSAGE(FATAL_ERROR
> "ITK not found. Please set ITK_DIR.")
> ENDIF(ITK_FOUND)
>
> FIND_PACKAGE(QT)
> IF(QT_FOUND)
> INCLUDE_DIRECTORIES( ${QT_INCLUDE_DIR})
> ELSE(QT_FOUND)
> MESSAGE(FATAL_ERROR
> "Qt not found.")
> ENDIF(QT_FOUND)
>
> LINK_LIBRARIES(ITKIO ${QT_LIBRARIES} )
>
> ADD_EXECUTABLE(SegmItk1 main.cxx PicWidget.cxx PictureData.cxx PicDisplay.cxx)
>
> TARGET_LINK_LIBRARIES(SegmItk1 ITKCommon)
>
>
>
> Again, if I try to build my own project in Visual studio after running Cmake , I get errors ("Nichtaufgeloestes externes Symbol" means "unresolved external symbol"):
>
> PicWidget.obj : error LNK2001: Nichtaufgeloestes externes Symbol "public: virtual bool __thiscall PicWidget::qt_property(int,int,class QVariant *)" (?qt_property at PicWidget@@UAE_NHHPAVQVariant@@@Z)
> PicWidget.obj : error LNK2001: Nichtaufgeloestes externes Symbol "public: virtual bool __thiscall PicWidget::qt_emit(int,struct QUObject *)" (?qt_emit at PicWidget@@UAE_NHPAUQUObject@@@Z)
> PicWidget.obj : error LNK2001: Nichtaufgeloestes externes Symbol "public: virtual bool __thiscall PicWidget::qt_invoke(int,struct QUObject *)" (?qt_invoke at PicWidget@@UAE_NHPAUQUObject@@@Z)
> PicWidget.obj : error LNK2001: Nichtaufgeloestes externes Symbol "public: virtual void * __thiscall PicWidget::qt_cast(char const *)" (?qt_cast at PicWidget@@UAEPAXPBD at Z)
> PicWidget.obj : error LNK2001: Nichtaufgeloestes externes Symbol "public: virtual char const * __thiscall PicWidget::className(void)const " (?className at PicWidget@@UBEPBDXZ)
> PicWidget.obj : error LNK2001: Nichtaufgeloestes externes Symbol "public: static class QMetaObject * __cdecl PicWidget::staticMetaObject(void)" (?staticMetaObject at PicWidget@@SAPAVQMetaObject@@XZ)
> PicDisplay.obj : error LNK2001: Nichtaufgeloestes externes Symbol "public: virtual bool __thiscall PicDisplay::qt_property(int,int,class QVariant *)" (?qt_property at PicDisplay@@UAE_NHHPAVQVariant@@@Z)
> PicDisplay.obj : error LNK2001: Nichtaufgeloestes externes Symbol "public: virtual bool __thiscall PicDisplay::qt_emit(int,struct QUObject *)" (?qt_emit at PicDisplay@@UAE_NHPAUQUObject@@@Z)
> PicDisplay.obj : error LNK2001: Nichtaufgeloestes externes Symbol "public: virtual bool __thiscall PicDisplay::qt_invoke(int,struct QUObject *)" (?qt_invoke at PicDisplay@@UAE_NHPAUQUObject@@@Z)
> PicDisplay.obj : error LNK2001: Nichtaufgeloestes externes Symbol "public: virtual void * __thiscall PicDisplay::qt_cast(char const *)" (?qt_cast at PicDisplay@@UAEPAXPBD at Z)
> PicDisplay.obj : error LNK2001: Nichtaufgeloestes externes Symbol "public: virtual char const * __thiscall PicDisplay::className(void)const " (?className at PicDisplay@@UBEPBDXZ)
> PicDisplay.obj : error LNK2001: Nichtaufgeloestes externes Symbol "public: static class QMetaObject * __cdecl PicDisplay::staticMetaObject(void)" (?staticMetaObject at PicDisplay@@SAPAVQMetaObject@@XZ)
> Debug/SegmItk1.exe : fatal error LNK1120: 12 unaufgeloeste externe Verweise
> Fehler beim Ausführen von link.exe.
>
> ALL_BUILD - 13 Fehler, 0 Warnung(en)
>
>
> Does anyone know what could be wrong ? Like I told: my own project runs when I build it with the help of qmake. Even the QTITK example from the applications doesn't run. So I think apart from my own (and maybe wrong) CMakeLists.txt file, there seems to be a more general problem . But I got the Itk "Hello World" program running , so I think the problem is rather with Cmake and Qt than with Cmake and itk ?
> One more thing I noticed is that , in the QTITK example as well as in my project, the classes of the project aren't shown in the workspace of the visual studio when opening it. There are only the ALL_BUILD node, the INSTALL node , and under the project node I only see a folder "global" with a main in it but not the classes I'm looking for.
> I'm using Itk version 2.0.1 , QT Educational Edition 3.3.3 and Microsoft visual Studio 6.0 .
> I would be glad if anyone can help me with this problem.
>
> Regards
>
> Philipp
>
>
>
> _________________________________________________________________________
> Mit der Gruppen-SMS von WEB.DE FreeMail können Sie eine SMS an alle
> Freunde gleichzeitig schicken: http://freemail.web.de/features/?mc=021179
>
>
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
>
More information about the Insight-users
mailing list