
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?):
> make
mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory `C:/Documents and Settings/pdrummond/Desktop/src/morph/GeMapMSUPlugin'
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
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"."
-I"C:/Qt/4.1.0/mkspecs/win32-g++" -o release\MSUDevicePlugin.o MSUDevicePlugin.cpp
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
pMSUPlugin.dll" release\MSUDevicePlugin.o release\MSUDeviceIcon.o release\moc_MSUDevicePlugin.o -L"C:\Qt\4.1.0\lib" -lQt3Support4 -lQtGui4 -lQtCore4
Creating library file: release\libGeMapMSUPlugin.a
release\MSUDevicePlugin.o(.text+0x896):MSUDevicePlugin.cpp: undefined reference to `MainWindow::canvas()'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [release\GeMapMSUPlugin.dll] Error 1
mingw32-make[1]: Leaving directory `C:/Documents and Settings/pdrummond/Desktop/src/morph/GeMapMSUPlugin'
mingw32-make: *** [release] Error 2
> make
mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory `C:/Documents and Settings/pdrummond/Desktop/src/morph/GeMapMSUPlugin'
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
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"."
-I"C:/Qt/4.1.0/mkspecs/win32-g++" -o release\MSUDevicePlugin.o MSUDevicePlugin.cpp
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
pMSUPlugin.dll" release\MSUDevicePlugin.o release\MSUDeviceIcon.o release\moc_MSUDevicePlugin.o -L"C:\Qt\4.1.0\lib" -lQt3Support4 -lQtGui4 -lQtCore4
Creating library file: release\libGeMapMSUPlugin.a
release\MSUDevicePlugin.o(.text+0x896):MSUDevicePlugin.cpp: undefined reference to `MainWindow::canvas()'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [release\GeMapMSUPlugin.dll] Error 1
mingw32-make[1]: Leaving directory `C:/Documents and Settings/pdrummond/Desktop/src/morph/GeMapMSUPlugin'
mingw32-make: *** [release] Error 2
To copy to clipboard, switch view to plain text mode
Something isn't quite right here! Any ideas?
Bookmarks