Results 1 to 5 of 5

Thread: Plugins HowTo?

  1. #1
    Join Date
    Jan 2006
    Posts
    18
    Thanks
    4
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Question Plugins HowTo?

    I hope someone can help me, I am trying to learn how to develop a simple plugin system.

    I am running Qt4.1.4 compiled with MingW on Windows XP.

    I have tried following the Qt documentation and some of the threads on this forum but cannot get it working.

    I have attached my code, don't laugh , so maybe some of you wise people can help.

    Thanks,
    Royce
    Attached Files Attached Files

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 975 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Plugins HowTo?

    You must compile both the plugin and application in the same mode, so you have to add "CONFIG += release" to PluginExample.pro.

  3. #3
    Join Date
    Jan 2006
    Posts
    18
    Thanks
    4
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Plugins HowTo?

    i am trying to compile the plugin and get the following error:

    B:\Programming\PluginExample\PluginExample\plugins _source>qmake && make
    make -f Makefile.Release
    make[1]: Entering directory `B:/Programming/PluginExample/PluginExample/plugins_source'
    g++ -c -O2 -O2 -frtti -fexceptions -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DMY_LIB_DLL -DQT_DLL -DQT_NO_DEBUG -DQT_PLUGIN -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -
    I"C:/Devel/Qt/4.1.4/include/QtCore" -I"C:/Devel/Qt/4.1.4/include/QtGui" -I"C:/Devel/Qt/4.1.4/include" -I"C:/Devel/Qt/4.1.4/include/ActiveQt" -I"release" -I"." -I"c:\Devel
    \Qt\4.1.4\mkspecs\win32-g++" -o release\helloworld_plugin.o helloworld_plugin.cpp
    c:\Devel\Qt\4.1.4\bin\moc.exe -DUNICODE -DQT_LARGEFILE_SUPPORT -DMY_LIB_DLL -DQT_DLL -DQT_NO_DEBUG -DQT_PLUGIN -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"C:/Devel/
    Qt/4.1.4/include/QtCore" -I"C:/Devel/Qt/4.1.4/include/QtGui" -I"C:/Devel/Qt/4.1.4/include" -I"C:/Devel/Qt/4.1.4/include/ActiveQt" -I"release" -I"." -I"c:\Devel\Qt\4.1.4\m
    kspecs\win32-g++" -D__GNUC__ -DWIN32 helloworld_plugin.h -o release\moc_helloworld_plugin.cpp
    g++ -c -O2 -O2 -frtti -fexceptions -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DMY_LIB_DLL -DQT_DLL -DQT_NO_DEBUG -DQT_PLUGIN -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -
    I"C:/Devel/Qt/4.1.4/include/QtCore" -I"C:/Devel/Qt/4.1.4/include/QtGui" -I"C:/Devel/Qt/4.1.4/include" -I"C:/Devel/Qt/4.1.4/include/ActiveQt" -I"release" -I"." -I"c:\Devel
    \Qt\4.1.4\mkspecs\win32-g++" -o release\moc_helloworld_plugin.o release\moc_helloworld_plugin.cpp
    g++ -mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-s -Wl,-s -shared -Wl,--out-implib,..\plugins\libhelloworld_plugin.a
    -o "..\plugins\helloworld_plugin.dll" release\helloworld_plugin.o release\moc_helloworld_plugin.o -L"c:\Devel\Qt\4.1.4\lib" -lQtGui -lgdi32 -lcomdlg32 -loleaut32 -limm32
    -lwinmm -lwinspool -lmsimg32 -lQtCore -lkernel32 -luser32 -lshell32 -luuid -lole32 -ladvapi32 -lws2_32
    Creating library file: ..\plugins\libhelloworld_plugin.a
    release\helloworld_plugin.o(.text+0x33):helloworld _plugin.cpp: undefined reference to `_imp___ZN7QString11shared_nullE'
    release\helloworld_plugin.o(.text+0x6a):helloworld _plugin.cpp: undefined reference to `_imp___ZN7QString9fromAsciiEPKci'
    release\helloworld_plugin.o(.text+0x7f):helloworld _plugin.cpp: undefined reference to `_imp___ZN7QStringaSERKS_'
    release\helloworld_plugin.o(.text+0xfe):helloworld _plugin.cpp: undefined reference to `_imp___ZN7QString4freeEPNS_4DataE'
    release\helloworld_plugin.o(.text+0x122):helloworl d_plugin.cpp: undefined reference to `_imp___ZN7QString4freeEPNS_4DataE'
    release\helloworld_plugin.o(.text+0x14f):helloworl d_plugin.cpp: undefined reference to `_imp___ZN11QMetaObject11removeGuardEPP7QObject'
    release\helloworld_plugin.o(.text+0x21f):helloworl d_plugin.cpp: undefined reference to `_imp___ZN7QObjectC2EPS_'
    release\helloworld_plugin.o(.text+0x254):helloworl d_plugin.cpp: undefined reference to `_imp___ZN11QMetaObject11changeGuardEPP7QObjectS1_ '
    release\moc_helloworld_plugin.o(.text+0xd2):moc_he lloworld_plugin.cpp: undefined reference to `_imp___ZN7QObject16staticMetaObjectE'
    release\moc_helloworld_plugin.o(.text$_ZN16HelloWo rldPluginD1Ev[HelloWorldPlugin::~HelloWorldPlugin()]+0x1b):moc_helloworld_plugin.cpp: undefined reference to `_imp___ZN7
    QObjectD2Ev'
    release\moc_helloworld_plugin.o(.text$_ZN16HelloWo rldPluginD0Ev[HelloWorldPlugin::~HelloWorldPlugin()]+0x1c):moc_helloworld_plugin.cpp: undefined reference to `_imp___ZN7
    QObjectD2Ev'
    collect2: ld returned 1 exit status
    make[1]: *** [..\plugins\helloworld_plugin.dll] Error 1
    make[1]: Leaving directory `B:/Programming/PluginExample/PluginExample/plugins_source'
    make: *** [release] Error 2
    Thanks,
    Royce
    Last edited by wysota; 18th October 2006 at 09:31. Reason: Changed [code] into [quote] to allow text wrapping

  4. #4
    Join Date
    Jan 2006
    Posts
    18
    Thanks
    4
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Plugins HowTo?

    OK this may seem an extremely newbish reponse. But do I have to compile Qt into shared mode to allow plugins for my apps to be created?

    It is just I downloaded Qt 4.2 and compiled a shared build instead of a static build. I was then able to compile my plugin into a .dll with no errors.

    Royce

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Plugins HowTo?

    Qt is by default compiled in shared mode. You have to provide a "-static" parameter to configure to build a static library. If you want to use plugins, then of course you need a shared build.

Similar Threads

  1. Plugins support Help!
    By Chaid in forum Qt Programming
    Replies: 5
    Last Post: 4th July 2006, 15:07
  2. Arthur Plugins demos and designer
    By antonio.r.tome in forum Installation and Deployment
    Replies: 4
    Last Post: 21st March 2006, 14:01
  3. How to reload widget plugins?
    By victorng in forum Qt Programming
    Replies: 2
    Last Post: 1st March 2006, 23:27
  4. Plugins that use *.ui based classes
    By blackliteon in forum Qt Programming
    Replies: 2
    Last Post: 6th February 2006, 09:33
  5. Plugins as small application
    By blackliteon in forum Qt Programming
    Replies: 4
    Last Post: 12th January 2006, 09:39

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.