PDA

View Full Version : QTPLUGIN += qjpeg doesnt let me compile



locke
16th August 2010, 10:43
Hi guys,

Im triying to save pictures as jpeg format. I do what trolls said in http://doc.trolltech.com/4.3/plugins-howto.html#static-plugins
but when I include the line


QTPLUGIN += qjpeg


then, error: collect2: ld returned 1 exit status appears. What am I doing wrong?

thanks

saa7_go
16th August 2010, 13:09
Have you rebuild qjpeg plugin as static library?

locke
16th August 2010, 13:34
I have all the libraries in C:\Qt\2010.01\qt\plugins\imageformats. I have qjpeg4.dll, qjpeg4d.dll, qjpeg4.a, qjpeg4d.a

saa7_go
16th August 2010, 14:02
I have all the libraries in C:\Qt\2010.01\qt\plugins\imageformats. I have qjpeg4.dll, qjpeg4d.dll, qjpeg4.a, qjpeg4d.a

No, all files you mention are dynamic plugins. You must build the qjpeg plugin as a static plugin.

Quoting from http://doc.trolltech.com/4.3/plugins-howto.html#static-plugins


It is also possible to create your own static plugins, by following these steps:

1. Add CONFIG += static to your plugin's .pro file.
2. Use the Q_IMPORT_PLUGIN() macro in your application.
3. Link your application with your plugin library using LIBS in the .pro file.

locke
16th August 2010, 14:42
I changed the things and now it works. But the way I did it is like I was creating a new plugind, not using an exsiting one. Istead of include the jpeg plugin like QTPLUGIN += qjpeg I needed to compile the plugins statically and then link the libraries using LIBS in my .pro file.

dhjdhj
22nd February 2011, 21:04
I tried to do this as well (on a Macintosh) and I"m getting errors like the following:

Undefined symbols for architecture x86_64:
"qt_plugin_instance_qjpeg()", referenced from:
__static_initialization_and_destruction_0(int, int)in main.o

Anyone know how to fix this issue?


P.S. --- I looked in the libqjpeg.dylib with nm and noted that there is an entry called _qt_plugin_instance, but there is NOT an entry called _qt_plugin_instance_qjpeg, which is being defined by the Q_IMPORT_PLUGIN macro.