Quote Originally Posted by wysota
Yes, it is possible.
Excellent. Do you have any idea why my code doesn't work then? I can post some code showing how I have implemented this, but firstly let me explain the problem - it's quicker that way.

I have a MainWindow and a Plugin which is passed the mainwindow pointer - much like your example. The Plugin can use the main window pointer to access data members in the mainwindow. However, if I try to call a function, that's where the problems occur!

In Linux I get a symbol error:

symbol lookup error: libGeMapMSUPlugin.so: undefined symbol:
_ZN10MainWindow6canvasEv

In Windows, the plugin won't even compile which is strange! I get the following link error (link errors in a library - whats going on?):

Qt Code:
  1. > make
  2. mingw32-make -f Makefile.Release
  3. mingw32-make[1]: Entering directory `C:/Documents and Settings/pdrummond/Desktop/src/morph/GeMapMSUPlugin'
  4. g++ -c -O2 -O2 -Wall -frtti -fexceptions -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_PLUGIN -DQT_QT3SUPPORT_LIB -DQT3_SUPPORT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREA
  5. D_SUPPORT -I"C:/Qt/4.1.0/include/QtCore" -I"C:/Qt/4.1.0/include/QtGui" -I"C:/Qt/4.1.0/include/Qt3Support" -I"C:/Qt/4.1.0/include" -I"C:/Qt/4.1.0/include/ActiveQt" -I"release" -I"."
  6. -I"C:/Qt/4.1.0/mkspecs/win32-g++" -o release\MSUDevicePlugin.o MSUDevicePlugin.cpp
  7. g++ -mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-s -Wl,-s -shared -Wl,--out-implib,release\libGeMapMSUPlugin.a -o "release\GeMa
  8. pMSUPlugin.dll" release\MSUDevicePlugin.o release\MSUDeviceIcon.o release\moc_MSUDevicePlugin.o -L"C:\Qt\4.1.0\lib" -lQt3Support4 -lQtGui4 -lQtCore4
  9. Creating library file: release\libGeMapMSUPlugin.a
  10. release\MSUDevicePlugin.o(.text+0x896):MSUDevicePlugin.cpp: undefined reference to `MainWindow::canvas()'
  11. collect2: ld returned 1 exit status
  12. mingw32-make[1]: *** [release\GeMapMSUPlugin.dll] Error 1
  13. mingw32-make[1]: Leaving directory `C:/Documents and Settings/pdrummond/Desktop/src/morph/GeMapMSUPlugin'
  14. mingw32-make: *** [release] Error 2
To copy to clipboard, switch view to plain text mode 

Something isn't quite right here! Any ideas?