Thread: mbarcode
View Single Post
Posts: 252 | Thanked: 252 times | Joined on Nov 2009
#433
@Wikiwide: I believe it has something to do with putting all functions and headers into one .cpp file. I tried compiling your code with all classes and headers in one file and it failed to load. Separating them into their respective .cpp and .h files made the plugin compile and load without problems.

I did this with qmake and make, but I believe it should be possible to do this with g++ alone. The commands issued by qmake and make are as follows:
Code:
g++ -c -pipe -O3 -fno-omit-frame-pointer -fno-optimize-sibling-calls -Wall -W -D_REENTRANT -fPIC -DQT_GL_NO_SCISSOR_TEST -DQT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH=1024 -DDATADIR="/usr/share" -DPKGDATADIR="" -DQT_NO_DEBUG -DQT_PLUGIN -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/linux-g++-maemo5 -I. -I/targets/FREMANTLE_ARMEL/usr/include/QtCore -I/targets/FREMANTLE_ARMEL/usr/include/QtGui -I/targets/FREMANTLE_ARMEL/usr/include -I../.. -I. -o plugin.o plugin.cpp
g++ -c -pipe -O3 -fno-omit-frame-pointer -fno-optimize-sibling-calls -Wall -W -D_REENTRANT -fPIC -DQT_GL_NO_SCISSOR_TEST -DQT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH=1024 -DDATADIR="/usr/share" -DPKGDATADIR="" -DQT_NO_DEBUG -DQT_PLUGIN -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/linux-g++-maemo5 -I. -I/targets/FREMANTLE_ARMEL/usr/include/QtCore -I/targets/FREMANTLE_ARMEL/usr/include/QtGui -I/targets/FREMANTLE_ARMEL/usr/include -I../.. -I. -o showdialogaction.o showdialogaction.cpp
showdialogaction.cpp:16: warning: unused parameter 'parentWindow'
/usr/bin/moc -DQT_GL_NO_SCISSOR_TEST -DQT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH=1024 -DDATADIR="/usr/share" -DPKGDATADIR="" -DQT_NO_DEBUG -DQT_PLUGIN -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/linux-g++-maemo5 -I. -I/targets/FREMANTLE_ARMEL/usr/include/QtCore -I/targets/FREMANTLE_ARMEL/usr/include/QtGui -I/targets/FREMANTLE_ARMEL/usr/include -I../.. -I. plugin.h -o moc_plugin.cpp
g++ -c -pipe -O3 -fno-omit-frame-pointer -fno-optimize-sibling-calls -Wall -W -D_REENTRANT -fPIC -DQT_GL_NO_SCISSOR_TEST -DQT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH=1024 -DDATADIR="/usr/share" -DPKGDATADIR="" -DQT_NO_DEBUG -DQT_PLUGIN -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/linux-g++-maemo5 -I. -I/targets/FREMANTLE_ARMEL/usr/include/QtCore -I/targets/FREMANTLE_ARMEL/usr/include/QtGui -I/targets/FREMANTLE_ARMEL/usr/include -I../.. -I. -o moc_plugin.o moc_plugin.cpp
/usr/bin/moc -DQT_GL_NO_SCISSOR_TEST -DQT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH=1024 -DDATADIR="/usr/share" -DPKGDATADIR="" -DQT_NO_DEBUG -DQT_PLUGIN -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/linux-g++-maemo5 -I. -I/targets/FREMANTLE_ARMEL/usr/include/QtCore -I/targets/FREMANTLE_ARMEL/usr/include/QtGui -I/targets/FREMANTLE_ARMEL/usr/include -I../.. -I. showdialogaction.h -o moc_showdialogaction.cpp
g++ -c -pipe -O3 -fno-omit-frame-pointer -fno-optimize-sibling-calls -Wall -W -D_REENTRANT -fPIC -DQT_GL_NO_SCISSOR_TEST -DQT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH=1024 -DDATADIR="/usr/share" -DPKGDATADIR="" -DQT_NO_DEBUG -DQT_PLUGIN -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/linux-g++-maemo5 -I. -I/targets/FREMANTLE_ARMEL/usr/include/QtCore -I/targets/FREMANTLE_ARMEL/usr/include/QtGui -I/targets/FREMANTLE_ARMEL/usr/include -I../.. -I. -o moc_showdialogaction.o moc_showdialogaction.cpp
rm -f libmbarcode_myplugin.so
g++ -Wl,-rpath-link,/usr/lib -Wl,-O1 -Wl,--hash-style=gnu -Wl,-rpath,/usr/lib -shared -o libmbarcode_myplugin.so plugin.o showdialogaction.o moc_plugin.o moc_showdialogaction.o   -L/usr/lib -lQtGui -L/usr/lib -L/usr/X11R6/lib -lQtCore -lpthread
This of course includes some of Qt's moc stuff, which I'm not sure is needed for this example. I'm also unsure wether g++ will play along with all of Qt's macros without having qmake run together with make.

I don't think that plugins for mbarcode are the easiest thing for testing wether or not Qt will play ball without qmake and suggest that you test these things out with simpler Qt examples first.

In any case, good luck!
 

The Following 2 Users Say Thank You to dragly For This Useful Post: