Ubuntu 9.04下编译QT及Qvfb遇到的问题

Ubuntu 9.04下编译QT及Qvfb遇到问题的解决:

1、/usr/bin/ld: cannot find -lXtst这个问题是库名称的问题,一般库后都有.so.6等数字,而qt编译时,这样的库名识别不了,解决办法是建立一个不带数字后最的库名的软连接
如这个问题:sudo ln -s /usr/lib/libXtst.so.6 /usr/lib/libXtst.so,然后ok

2、找不到XTest.h和XInput.h 要装两个包:

XTest.h----libext-dev
XInput.h ---libxi-dev

3、编译qvfb遇到的问题

一定要用qmake
转载,和他遇到的问题一样,解决方法就是参照他的
译结束后我尝试的步骤如下: (着急的直接看最后几行!!)

1.进入qvfb源码目录:
# cd /home/src/qt-x11-opensource-src-4.4.3/tools/qvfb
2.执行qmake生成pro工程:
# /home/src/qt-x11-opensource-src-4.4.3/bin/qmake -project
3.执行qmake生成Makefile
# /home/src/qt-x11-opensource-src-4.4.3/bin/qmake
4.编译make
# make

有错误:
g++ -c -pipe -g -O2 -Wall -W -D_REENTRANT -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I../../mkspecs/linux-g++ -I. -I../../include/QtCore -I../../include/QtCore -I../../include/QtGui -I../../include/QtGui -I../../include -I. -I.moc/release-shared -I.uic/release-shared -o .obj/release-shared/qvfb.o qvfb.cpp
qvfb.cpp:47:24: 错误:deviceskin.h:没有那个文件或目录
qvfb.cpp: In member function ‘void QVFb::init(int, int, int, int, int, const QString&)’:
qvfb.cpp:247: 警告:检测到调用 delete 运算符时可能出现的问题:
qvfb.cpp:247: 警告:invalid use of undefined type ‘struct DeviceSkin’
qvfb.h:53: 警告:forward declaration of ‘struct DeviceSkin’
qvfb.cpp:247: 附注:析构函数和类特定的 delete 运算符均不会被调用,即使它们在类定义时已经声明。
qvfb.cpp:257: 错误:‘DeviceSkinParameters’ 在此作用域中尚未声明
qvfb.cpp:257: 错误:expected `;'' before ‘parameters’
qvfb.cpp:259: 错误:‘parameters’ 在此作用域中尚未声明
qvfb.cpp:259: 错误:‘DeviceSkinParameters’ is not a class or namespace
qvfb.cpp:260: 错误:invalid use of undefined type ‘struct DeviceSkin’
qvfb.h:53: 错误:forward declaration of ‘struct DeviceSkin’
qvfb.cpp:261: 错误:对 ‘QVFb::connect(DeviceSkin*&, const char [13], QVFb* const, const char [13])’ 的调用没有匹配的函数
../../include/QtCore/../../src/corelib/kernel/qobject.h:197: 附注:备选为: static bool QObject::connect(const QObject*, const char*, const QObject*, const char*, Qt::ConnectionType)
../../include/QtCore/../../src/corelib/kernel/qobject.h:302: 附注:         bool QObject::connect(const QObject*, const char*, const char*, Qt::ConnectionType) const
qvfb.cpp:277: 错误:对 ‘QVFbX11View::QVFbX11View(int&, int&, int&, int&, QVFbAbstractView::Rotation&, DeviceSkin*&)’ 的调用没有匹配的函数
qvfbx11view.h:52: 附注:备选为: QVFbX11View::QVFbX11View(int, int, int, int, QVFbAbstractView::Rotation, QWidget*)
qvfbx11view.h:49: 附注:         QVFbX11View::QVFbX11View(const QVFbX11View&)
qvfb.cpp:280: 错误:对 ‘QVFbView::QVFbView(int&, int&, int&, int&, QVFbAbstractView::Rotation&, DeviceSkin*&)’ 的调用没有匹配的函数
qvfbview.h:109: 附注:备选为: QVFbView::QVFbView(int, int, int, int, QVFbAbstractView::Rotation, QWidget*)
qvfbview.h:106: 附注:         QVFbView::QVFbView(const QVFbView&)
qvfb.cpp:281: 错误:invalid use of undefined type ‘struct DeviceSkin’
qvfb.h:53: 错误:forward declaration of ‘struct DeviceSkin’
qvfb.cpp:284: 错误:对 ‘QVFb::connect(DeviceSkin*&, const char [37], QVFbAbstractView*&, const char [37])’ 的调用没有匹配的函数
../../include/QtCore/../../src/corelib/kernel/qobject.h:197: 附注:备选为: static bool QObject::connect(const QObject*, const char*, const QObject*, const char*, Qt::ConnectionType)
../../include/QtCore/../../src/corelib/kernel/qobject.h:302: 附注:         bool QObject::connect(const QObject*, const char*, const char*, Qt::ConnectionType) const
qvfb.cpp:285: 错误:对 ‘QVFb::connect(DeviceSkin*&, const char [39], QVFbAbstractView*&, const char [39])’ 的调用没有匹配的函数
../../include/QtCore/../../src/corelib/kernel/qobject.h:197: 附注:备选为: static bool QObject::connect(const QObject*, const char*, const QObject*, const char*, Qt::ConnectionType)
../../include/QtCore/../../src/corelib/kernel/qobject.h:302: 附注:         bool QObject::connect(const QObject*, const char*, const char*, Qt::ConnectionType) const
qvfb.cpp:287: 错误:invalid use of undefined type ‘struct DeviceSkin’
qvfb.h:53: 错误:forward declaration of ‘struct DeviceSkin’
qvfb.cpp:289: 错误:对 ‘QVFb::setCentralWidget(DeviceSkin*&)’ 的调用没有匹配的函数
../../include/QtGui/../../src/gui/widgets/qmainwindow.h:116: 附注:备选为: void QMainWindow::setCentralWidget(QWidget*)
qvfb.cpp:302: 错误:对 ‘QVFbX11View::QVFbX11View(int, int, int, int&, QVFbAbstractView::Rotation&, DeviceSkin*&)’ 的调用没有匹配的函数
qvfbx11view.h:52: 附注:备选为: QVFbX11View::QVFbX11View(int, int, int, int, QVFbAbstractView::Rotation, QWidget*)
qvfbx11view.h:49: 附注:         QVFbX11View::QVFbX11View(const QVFbX11View&)
qvfb.cpp:305: 错误:对 ‘QVFbView::QVFbView(int, int, int, int&, QVFbAbstractView::Rotation&, DeviceSkin*&)’ 的调用没有匹配的函数
qvfbview.h:109: 附注:备选为: QVFbView::QVFbView(int, int, int, int, QVFbAbstractView::Rotation, QWidget*)
qvfbview.h:106: 附注:         QVFbView::QVFbView(const QVFbView&)
qvfb.cpp:306: 错误:invalid use of undefined type ‘struct DeviceSkin’
qvfb.h:53: 错误:forward declaration of ‘struct DeviceSkin’
qvfb.cpp: In member function ‘void QVFb::enableCursor(bool)’:
qvfb.cpp:379: 错误:invalid use of undefined type ‘struct DeviceSkin’
qvfb.h:53: 错误:forward declaration of ‘struct DeviceSkin’
qvfb.cpp: In member function ‘void QVFb::setZoom(double)’:
qvfb.cpp:453: 错误:invalid use of undefined type ‘struct DeviceSkin’
qvfb.h:53: 错误:forward declaration of ‘struct DeviceSkin’
qvfb.cpp: In member function ‘void QVFb::skinConfigChosen(int)’:
qvfb.cpp:771: 错误:‘DeviceSkinParameters’ 在此作用域中尚未声明
qvfb.cpp:771: 错误:expected `;'' before ‘parameters’
qvfb.cpp:773: 错误:‘parameters’ 在此作用域中尚未声明
qvfb.cpp:773: 错误:‘DeviceSkinParameters’ is not a class or namespace
make: *** [.obj/release-shared/qvfb.o] 错误 1
差点就放弃了。后来仔细看了一下编译错误。估计主要是差个头文件:
qvfb.cpp:47:24: 错误:deviceskin.h:没有那个文件或目录
一般差头文件会导致cpp文件中很多数据结构和常量没有定义。找到头文件deviceskin.h在qt-x11-opensource-src-4.4.3/tools/shared/deviceskin/下面。拷贝到qvfb文件夹下。再编译:

编译没有问题,连接出错:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/28300.html