[Qt-interest] plugin can't be loaded under Windows
Dong Tiger
idlecat511 at gmail.com
Mon Jul 13 06:59:17 CEST 2009
Thanks god I fixed it.
Google help me find this link:
https://svn9.cvsdude.com/vvc/kdesolaris/trunk/PHONON/4.2/CMakeLists.txt?revision=3023&view=markup
In this file building under windows with mingw is specially treated, that
is:
<quote>
if (MINGW)
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}
-Wl,--export-all-symbols -Wl,--disable-auto-import")
set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}
-Wl,--export-all-symbols -Wl,--disable-auto-import")
# we always link against the release version of QT with mingw
# (even for debug builds). So we need to define QT_NO_DEBUG
# or else QPluginLoader rejects plugins because it thinks
# they're built against the wrong QT.
add_definitions(-DQT_NO_DEBUG)
endif (MINGW)
</quote>
By copy this snippet to my CMakeLists.txt, the problem is gone.
Specifically, only "add_definitions(-DQT_NO_DEBUG)" is necessay.
--
Tiger
2009/7/11 <clinton at elemtech.com>
>
> Maybe be sure you're using a recent cmake version?
> If the one you have is really old, it didn't add the right compile flags
> for plugins to work right.
>
> Clint
>
>
> ----- Original Message -----
> From: "Dong Tiger" <idlecat511 at gmail.com>
> To: "Ender EREL" <erelender at yahoo.com>
> Cc: qt-interest at trolltech.com
> Sent: Friday, July 10, 2009 8:31:45 AM GMT -07:00 US/Canada Mountain
> Subject: Re: [Qt-interest] plugin can't be loaded under Windows
>
>
>
> Hi Ender,
>
> The error msg says "(The plugin) uses incompatible Qt library. (Cannot mix
> debug and release libraries.)". So I think you are right.
> But I have no idea why it happens since all the code are in same CMake
> project and built with same configuration.
>
>
> --
> Tiger
>
>
>
>
>
> 2009/7/10 Ender EREL < erelender at yahoo.com >
>
>
>
>
>
> Dong Tiger wrote:
> > Hi,
> >
> > I ran into a strange problem. I am using
> > Qt(qt-sdk-win-opensource-2009.01.1) and MinGW(gcc 4.4.0). CMake is used
> > as the build system. And I used Qt Plugin mechanism in my program.
> >
> > If I compile the code with debug enabled ( cmake
> > -DCMAKE_BUILD_TYPE=debug), plugins will be loaded successfully. But if
> > not, QPluginLoader::instance just returns NULL.
> >
> > I tried to compare the cmd line of debug mode and non debug mode. The
> > only difference seems to be that in debug mode there is " -DQT_DEBUG" in
> > g++ arguments and non-debug mode doesn't have that.
> >
> > Any idea of that? TIA.
> >
> > --
> > Tiger
>
> What does QPluginLoader.errorString() method return?
>
> If the plugins are built in debug mode and your application is built in
> release mode, the configuration difference may be causing this.
>
> --
> Ender EREL
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090713/ec9fbc47/attachment.html
More information about the Qt-interest-old
mailing list