[vtkusers] cmake error: no qvtkwidget.h is found

Yifei Li yifli at mtu.edu
Mon Mar 30 11:17:54 EDT 2009


Michale,
Thank you for the reply.  I did see -I/usr/include/vtk

Here's what I got:

/usr/bin/c++   -Wno-deprecated -I/usr/include/QtGui 
-I/usr/include/QtCore -I/usr/include/vtk -I/usr/include/python2.5 
-I/usr/include/freetype2 -I/home/grad/yifli/workspace/mainwindow   
-DQT_SHARED -DQT_GUI_LIB -DQT_CORE_LIB -o CMakeFiles/editor.dir/main.o 
-c /home/grad/yifli/workspace/mainwindow/main.cpp

Yifei

Michael Jackson wrote:
> You are probably missing the include directory where qvtkwidget.h is 
> found.
>
> Do "make VERBOSE=1" and make sure /usr/include/vtk is present in the 
> compile command. Should be something like
>
> -I/usr/include/vtk
>
> HTH
> _________________________________________________________
> Mike Jackson                  mike.jackson at bluequartz.net
> BlueQuartz Software                    www.bluequartz.net
> Principal Software Engineer                  Dayton, Ohio
>
>
>
> On Mar 30, 2009, at 10:30 AM, Yifei Li wrote:
>
>> 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
>>
>> /******************************************************************************** 
>>
>> ** Form generated from reading ui file 'editor.ui'
>> **
>> ** Created: Mon Mar 30 09:56:52 2009
>> **      by: Qt User Interface Compiler version 4.3.5
>> **
>> ** WARNING! All changes made in this file will be lost when 
>> recompiling ui file!
>> ********************************************************************************/ 
>>
>>
>> #ifndef UI_EDITOR_H
>> #define UI_EDITOR_H
>>
>> #include <QtCore/QVariant>
>> #include <QtGui/QAction>
>> #include <QtGui/QApplication>
>> #include <QtGui/QButtonGroup>
>> #include <QtGui/QMainWindow>
>> #include <QtGui/QMenu>
>> #include <QtGui/QMenuBar>
>> #include <QtGui/QStatusBar>
>> #include <QtGui/QVBoxLayout>
>> #include <QtGui/QWidget>
>> #include <qvtkwidget.h>
>>
>> class Ui_MainWindow
>> {
>> public:
>>    QWidget *centralwidget;
>>    QWidget *verticalLayoutWidget;
>>    QVBoxLayout *vboxLayout;
>>    QVTKWidget *vtkwidget;
>>    QMenuBar *menubar;
>>    QMenu *menuFile;
>>    QStatusBar *statusbar;
>>
>>    void setupUi(QMainWindow *MainWindow)
>>    {
>>    if (MainWindow->objectName().isEmpty())
>>        MainWindow->setObjectName(QString::fromUtf8("MainWindow"));
>>    MainWindow->resize(800, 600);
>>    centralwidget = new QWidget(MainWindow);
>>    centralwidget->setObjectName(QString::fromUtf8("centralwidget"));
>>    centralwidget->setGeometry(QRect(0, 21, 800, 560));
>>    verticalLayoutWidget = new QWidget(centralwidget);
>>    
>> verticalLayoutWidget->setObjectName(QString::fromUtf8("verticalLayoutWidget")); 
>>
>>    verticalLayoutWidget->setGeometry(QRect(0, 0, 791, 551));
>>    vboxLayout = new QVBoxLayout(verticalLayoutWidget);
>>    vboxLayout->setObjectName(QString::fromUtf8("vboxLayout"));
>>    vboxLayout->setContentsMargins(0, 0, 0, 0);
>>    vtkwidget = new QVTKWidget(verticalLayoutWidget);
>>    vtkwidget->setObjectName(QString::fromUtf8("vtkwidget"));
>>
>>    vboxLayout->addWidget(vtkwidget);
>>
>>    MainWindow->setCentralWidget(centralwidget);
>>    menubar = new QMenuBar(MainWindow);
>>    menubar->setObjectName(QString::fromUtf8("menubar"));
>>    menubar->setGeometry(QRect(0, 0, 800, 21));
>>    menuFile = new QMenu(menubar);
>>    menuFile->setObjectName(QString::fromUtf8("menuFile"));
>>    MainWindow->setMenuBar(menubar);
>>    statusbar = new QStatusBar(MainWindow);
>>    statusbar->setObjectName(QString::fromUtf8("statusbar"));
>>    statusbar->setGeometry(QRect(0, 581, 800, 19));
>>    MainWindow->setStatusBar(statusbar);
>>
>>    menubar->addAction(menuFile->menuAction());
>>
>>    retranslateUi(MainWindow);
>>
>>    QMetaObject::connectSlotsByName(MainWindow);
>>    } // setupUi
>>
>>    void retranslateUi(QMainWindow *MainWindow)
>>    {
>>    MainWindow->setWindowTitle(QApplication::translate("MainWindow", 
>> "MainWindow", 0, QApplication::UnicodeUTF8));
>>    menuFile->setTitle(QApplication::translate("MainWindow", "File", 
>> 0, QApplication::UnicodeUTF8));
>>    } // retranslateUi
>>
>> };
>>
>> namespace Ui {
>>    class MainWindow: public Ui_MainWindow {};
>> } // namespace Ui
>>
>> #endif // UI_EDITOR_H
>>  # set project's name
>>  PROJECT( editor )
>>
>>  # with SET() command you can change variables or define new ones
>>  # here we define SAMPLE_SRCS variable that contains a list of all 
>> .cpp files
>>  # note that we don't need \ at the end of line
>>  SET( SAMPLE_SRCS
>>     main.cpp
>>     editorwindow.cpp
>>  )
>>
>>  # another list, this time it includes all header files that should 
>> be treated
>>  # with moc
>>  SET( SAMPLE_MOC_HDRS
>>     editorwindow.h
>>  )
>>
>>  # some .ui files
>>  SET( SAMPLE_UIS
>>     editor.ui
>>  )
>>
>>
>>  # this command finds Qt4 libraries and sets all required variables
>>  # note that it's Qt4, not QT4 or qt4
>>  FIND_PACKAGE( Qt4 REQUIRED )
>>  FIND_PACKAGE( VTK )
>>
>>  # add some useful macros and variables
>>  # (QT_USE_FILE is a variable defined by FIND_PACKAGE( Qt4 ) that 
>> contains a
>>  # path to CMake script)
>>  INCLUDE( ${QT_USE_FILE} )
>>  INCLUDE( ${VTK_USE_FILE} )
>>
>>  # this will run uic on .ui files:
>>  QT4_WRAP_UI( SAMPLE_UI_HDRS ${SAMPLE_UIS} )
>>
>>  # and finally this will run moc:
>>  QT4_WRAP_CPP( SAMPLE_MOC_SRCS ${SAMPLE_MOC_HDRS} )
>>
>>  # we need this to be able to include headers produced by uic in our 
>> code
>>  # (CMAKE_BINARY_DIR holds a path to the build directory, while
>>  # INCLUDE_DIRECTORIES() works just like INCLUDEPATH from qmake)
>>  INCLUDE_DIRECTORIES( ${QT_INCLUDE_DIR} ${CMAKE_BINARY_DIR} )
>>
>>  # here we instruct CMake to build "sample" executable from all of 
>> the source
>>  # files
>>  ADD_EXECUTABLE( editor ${SAMPLE_SRCS} ${SAMPLE_MOC_SRCS} 
>> ${SAMPLE_UI_HDRS} )
>>
>>  # last thing we have to do is to tell CMake what libraries our 
>> executable
>>  # needs,
>>  # luckily FIND_PACKAGE prepared QT_LIBRARIES variable for us:
>>  TARGET_LINK_LIBRARIES( editor QVTK ${QT_LIBRARIES} )
>>
>> <ui version="4.0" >
>> <class>MainWindow</class>
>> <widget class="QMainWindow" name="MainWindow" >
>>  <property name="geometry" >
>>   <rect>
>>    <x>0</x>
>>    <y>0</y>
>>    <width>800</width>
>>    <height>600</height>
>>   </rect>
>>  </property>
>>  <property name="windowTitle" >
>>   <string>MainWindow</string>
>>  </property>
>>  <widget class="QWidget" name="centralwidget" >
>>   <property name="geometry" >
>>    <rect>
>>     <x>0</x>
>>     <y>21</y>
>>     <width>800</width>
>>     <height>560</height>
>>    </rect>
>>   </property>
>>   <widget class="QWidget" name="verticalLayoutWidget" >
>>    <property name="geometry" >
>>     <rect>
>>      <x>0</x>
>>      <y>0</y>
>>      <width>791</width>
>>      <height>551</height>
>>     </rect>
>>    </property>
>>    <layout class="QVBoxLayout" name="verticalLayout" >
>>     <item>
>>      <widget class="QVTKWidget" name="vtkwidget" />
>>     </item>
>>    </layout>
>>   </widget>
>>  </widget>
>>  <widget class="QMenuBar" name="menubar" >
>>   <property name="geometry" >
>>    <rect>
>>     <x>0</x>
>>     <y>0</y>
>>     <width>800</width>
>>     <height>21</height>
>>    </rect>
>>   </property>
>>   <widget class="QMenu" name="menuFile" >
>>    <property name="title" >
>>     <string>File</string>
>>    </property>
>>   </widget>
>>   <addaction name="menuFile" />
>>  </widget>
>>  <widget class="QStatusBar" name="statusbar" >
>>   <property name="geometry" >
>>    <rect>
>>     <x>0</x>
>>     <y>581</y>
>>     <width>800</width>
>>     <height>19</height>
>>    </rect>
>>   </property>
>>  </widget>
>> </widget>
>> <resources/>
>> <connections/>
>> </ui>
>> #include "editorwindow.h"
>>
>> EditorWindow::EditorWindow(QWidget * parent)
>>     : QMainWindow(parent)
>> {
>>     ui.setupUi(this);
>> }
>> #include <QMainWindow>
>> #include "ui_editor.h"
>>
>> class EditorWindow : public QMainWindow
>> {
>>     Q_OBJECT
>> public:
>>      EditorWindow(QWidget * parent = 0);
>> private:
>>      Ui::MainWindow ui;
>> };
>>
>> #include "editorwindow.h"
>> #include <QApplication>
>> #include <QtGui>
>>
>> int main(int argc, char ** argv)
>> {
>>    QApplication app(argc, argv);
>>    EditorWindow w;
>>    w.show();
>>    return app.exec();
>> }
>> _______________________________________________
>> 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