[vtkusers] cmake error: no qvtkwidget.h is found
Yifei Li
yifli at mtu.edu
Mon Mar 30 19:54:31 EDT 2009
Clinton,
Thank you so much.
You are right, I installed VTK using rpm and DESIRED_QT_VERSION is set
to 3. Here is what my VTKConfigQt.cmake looks like:
SET(VTK_QT_QT_LIBRARY "/usr/lib/qt-3.3/lib/libqt-mt.so")
SET(VTK_QT_INCLUDE_DIR "/usr/lib/qt-3.3/include")
SET(VTK_QT_QASSISTANTCLIENT_LIBRARY
"/usr/lib/qt-3.3/lib/libqassistantclient.a")
# exports for Qt4
SET(VTK_QT_RCC_EXECUTABLE "")
SET(VTK_DESIRED_QT_VERSION "3")
# exports for Qt3/Qt4
SET(VTK_QT_MOC_EXECUTABLE "/usr/lib/qt-3.3/bin/moc")
SET(VTK_QT_UIC_EXECUTABLE "/usr/lib/qt-3.3/bin/uic")
SET(VTK_QT_QMAKE_EXECUTABLE "")
Should I change this file manually?
Yifei
Clinton Stimpson wrote:
> Yifei Li wrote:
>> Hi all,
>>
>> I just made some progress. But I got a new problem - a linking error:
>>
>> CMakeFiles/editor.dir/editorwindow.o: In function
>> `Ui_MainWindow::setupUi(QMainWindow*)':
>> editorwindow.cpp:(.text._ZN13Ui_MainWindow7setupUiEP11QMainWindow[Ui_MainWindow::setupUi(QMainWindow*)]+0x492):
>> undefined reference to `QVTKWidget::QVTKWidget(QWidget*,
>> QFlags<Qt::WindowType>)'
> So I'm assuming you're using a VTK installation created by your Linux
> distribution? Some of the distros build QVTK with Qt3, so you can't
> use it with Qt4.
> Maybe that's your problem. Look for the VTKConfigQt.cmake file and
> see if it sets DESIRED_QT_VERSION=3.
>>
>> I fixed the previous problem by changing the name of the include
>> header 'qvtkwidget.h' (included in ui_editor.h) to 'QVTKWidget.h"
> You should fix it in your .ui file (with text editor or qt designer).
> The ui_editor.h is created from the .ui file.
> When you promote widgets in the designer, and type in the class name,
> it auto completes a header file for that class name - but its all
> lowercase. Its easiest to fix then.
>
> Clint
>>
>> However, the 'ui_editor.h' is automatically genereated after typing
>> 'make'. So is this a bug of cmake?? On the same machine where I
>> successfully built SimpleView, I did not have this problem.
>>
>> My computer is running Fedora 9 and cmake version is 2.4.
>>
>> Any ideas?
>>
>> Yifei
>>
>> Yifei Li wrote:
>>> Brian,
>>>
>>> I can build that example without problem. And I did learn a lot from
>>> its CMakeLists.txt
>>>
>>> Now I want to write my own CMakeLists.txt from scratch ( trying to
>>> get rid of those stuff that provides Qt3 compatbility in
>>> SimpleView) and have troubles. Here is my CMakeLists.txt. Using
>>> 'make verbose=1' did show '-I/usr/include/vtk'.
>>>
>>> Any help is highly apprecaited.
>>>
>>> Yifei
>>>
>>> PROJECT( editor )
>>>
>>> SET( SAMPLE_SRCS
>>> main.cpp
>>> editorwindow.cpp
>>> )
>>>
>>> SET( SAMPLE_MOC_HDRS
>>> editorwindow.h
>>> )
>>>
>>> SET( SAMPLE_UIS
>>> editor.ui
>>> )
>>>
>>>
>>> FIND_PACKAGE( Qt4 REQUIRED )
>>> FIND_PACKAGE( VTK )
>>>
>>> INCLUDE( ${QT_USE_FILE} )
>>> INCLUDE( ${VTK_USE_FILE} )
>>>
>>> QT4_WRAP_UI( SAMPLE_UI_HDRS ${SAMPLE_UIS} )
>>>
>>> QT4_WRAP_CPP( SAMPLE_MOC_SRCS ${SAMPLE_MOC_HDRS} )
>>>
>>> INCLUDE_DIRECTORIES( ${QT_INCLUDE_DIR} ${CMAKE_BINARY_DIR} )
>>>
>>> ADD_EXECUTABLE( editor ${SAMPLE_SRCS} ${SAMPLE_MOC_SRCS}
>>> ${SAMPLE_UI_HDRS} )
>>>
>>> TARGET_LINK_LIBRARIES( editor QVTK ${QT_LIBRARIES} )
>>> Wylie, Brian wrote:
>>>> Yifei,
>>>>
>>>> There's a 'SimpleView' example in VTK\Examples\GUI\Qt\SimpleView
>>>> that builds a small Qt/VTK application. You might look at it's
>>>> CMakeLists.txt file for guidance.
>>>> Also, looking through the generated Makefile (or windows project
>>>> file), may give you some clues.
>>>> Brian Wylie - Org 1424
>>>> Sandia National Laboratories
>>>> MS 1323 - Building CSRI/242
>>>> (505)844-2238 FAX(505)284-2518 _______ __
>>>> /_ __(_) /_____ _____
>>>> / / / / __/ __ `/ __ \
>>>> / / / / /_/ /_/ / / / /
>>>> /_/ /_/\__/\__,_/_/ /_/
>>>> Informatics Toolkit
>>>>
>>>> -----Original Message-----
>>>> From: vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] On
>>>> Behalf Of Yifei Li
>>>> Sent: Monday, March 30, 2009 8:30 AM
>>>> To: vtkusers at vtk.org
>>>> Subject: [vtkusers] cmake error: no qvtkwidget.h is found
>>>>
>>>> Hi,
>>>>
>>>> I'm still in the processing of learning cmake. Now I'm tring to
>>>> compile a very simple Qt/VTK program where a QVTKWidget is the only
>>>> widget in a QMainWindow. However, after typing make, I got the
>>>> following errors. (I did install 'vtk-qt-5.0.4-21.fc9.i386' and
>>>> QVTKWidget.h is in /usr/include/vtk)
>>>>
>>>> In file included from mainwindow/editorwindow.h:2, from
>>>> mainwindow/main.cpp:1:
>>>> mainwindow/ui_editor.h:23:24: error: qvtkwidget.h: No such file or
>>>> directory In file included from mainwindow/editorwindow.h:2, from
>>>> mainwindow/main.cpp:1:
>>>> mainwindow/ui_editor.h:31: error: ISO C++ forbids declaration of
>>>> 'QVTKWidget' with no type
>>>> mainwindow/ui_editor.h:31: error: expected ';' before '*' token
>>>> mainwindow/ui_editor.h: In member function 'void
>>>> Ui_MainWindow::setupUi(QMainWindow*)':
>>>> mainwindow/ui_editor.h:50: error: 'vtkwidget' was not declared in
>>>> this scope
>>>> mainwindow/ui_editor.h:50: error: expected type-specifier before
>>>> 'QVTKWidget'
>>>> mainwindow/ui_editor.h:50: error: expected `;' before 'QVTKWidget'
>>>>
>>>> I attached the CMakeLists.txt and my source code. Could anyone give
>>>> me some help? Thanks
>>>>
>>>> Yifei
>>>>
>>>>
>>>
>>> _______________________________________________
>>> 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
>
More information about the vtkusers
mailing list