• 7210阅读
  • 7回复

ubantu 编译qt程序报错。。。 [复制链接]

上一主题 下一主题
离线mpx1983
 

只看楼主 倒序阅读 楼主  发表于: 2009-11-16
在windows上编写好的程序,可以正常运行,拿到ubantu上去编译时报如下错误:
L/usr/local/Trolltech/Qt-4.5.0/lib -L/usr/X11R6/lib -lQtSql -L/usr/local/Trolltech/Qt-4.5.0/lib -lQtOpenGL -lQtGui -L/usr/X11R6/lib -lXext -lX11 -lQtCore -lm -lrt -ldl -lGLU -lGL -lpthread
/usr/local/Trolltech/Qt-4.5.0/lib/libQtOpenGL.so: undefined reference to `QX11PixmapData::QX11PixmapData(QPixmapData::PixelType)'
collect2: ld returned 1 exit status

其中“libQtOpenGL.so: undefined reference to `QX11PixmapData::QX11PixmapData(QPixmapData::PixelType)'”,这是什么原因导致的呀??

我的qt是自己编译安装的,然后qt-creator用的bin安装包。
离线steinlee

只看该作者 1楼 发表于: 2009-11-16
The error message means: QX11PixmapData::QX11PixmapData(QPixmapData::PixelType) is a constructor
of class QX11PixmapData is not defined in dynamic library libQtOpenGL.so.
type the following command to see functions defined in libQtOpenGL.so
nm /usr/local/Trolltech/Qt-4.5.0/lib/libQtOpenGL.so
You may be able to choose another constructor for your applications

引用楼主mpx1983于2009-11-16 09:37发表的 ubantu 编译qt程序报错。。。 :
在windows上编写好的程序,可以正常运行,拿到ubantu上去编译时报如下错误:
L/usr/local/Trolltech/Qt-4.5.0/lib -L/usr/X11R6/lib -lQtSql -L/usr/local/Trolltech/Qt-4.5.0/lib -lQtOpenGL -lQtGui -L/usr/X11R6/lib -lXext -lX11 -lQtCore -lm -lrt -ldl -lGLU -lGL -lpthread
/usr/local/Trolltech/Qt-4.5.0/lib/libQtOpenGL.so: undefined reference to `QX11PixmapData::QX11PixmapData(QPixmapData::PixelType)'
collect2: ld returned 1 exit status
.......
Looking for remote C/C++ and Qt 兼职
离线rqzrqh

只看该作者 2楼 发表于: 2009-11-16
楼主说可以再windows上运行我感到很奇怪,你使用的是QX11PixmapData::QX11PixmapData(QPixmapData::PixelType)这个构造函数,很明显它是在X11上才能编译的,但是windows可没有X11
离线mpx1983

只看该作者 3楼 发表于: 2009-11-16
thank you, steinlee
perhaps i don't describe the program directly;

first,i compile the QT source package on ubantu;
second,i download a bin qt-creator install package;
then,when i compile my program ,recieved that " don't find libQtOpenGL.so",i tried to find it in QT source folder ,in fact ,it really no it ;but i find it in qt-creator's folder;so i copy it to qt's lib folder ,than it can go to next step ;
bu at last ,a new problem come as top i asked.

so i think the problem breaked when i complite the Qt source package,why it can't born the libQtOpenGL.so;
because i don't install OpenGL on Ubantu ???
离线mpx1983

只看该作者 4楼 发表于: 2009-11-16
回 rqzrqh :
windows上的qt 和qt creator都是有现成安装包的,不用理会编译;
但linux上就得自己编译qt库了,官方没有给二进制安装包
可能原因出在我编译qt库上了,没有编译出libQtOpenGL.so,但为什么qt creator自带不行呢? 原因不明。。。
离线dbzhang800

只看该作者 5楼 发表于: 2009-11-16
1.  不清楚 Ubantu 和 Ubuntu 是不是同一个东西
2.  如果是的话,为什么不用源中的Qt呢,9.04中是 4.5.0, 9.10中是4.5.2/3 , 而ppa源中都有 4.6beta了

3. 从qt-creator包中拷贝了一个libQtOpenGL.so ?  你执行 ldd libQtOpenGL.so 看看依赖或者贴出来呢

4.主要还是考虑一下 为什么编译后没有这个库吧,另外 qtdemo中 opengl的例子你运行过了没?
离线wd007

只看该作者 6楼 发表于: 2009-11-16
在Linux上也有二进制的安装包,可以安装的。
欢迎访问我的博客,一起学习提高
http://blog.csdn.net/qter_wd007
离线steinlee

只看该作者 7楼 发表于: 2009-11-16
There may be version mismatch problem.
When you install Qt, check if you need to add option of OpenGL.
Normally you do not need to copy an opengl.so from other sources.
type configure --help to find what you can do for openGL in installation

引用第3楼mpx1983于2009-11-16 17:18发表的  :
thank you, steinlee
perhaps i don't describe the program directly;
first,i compile the QT source package on ubantu;
second,i download a bin qt-creator install package;
.......
Looking for remote C/C++ and Qt 兼职
快速回复
限100 字节
 
上一个 下一个