PDA

View Full Version : after compilingreceiving QtFatalMsg



quickNitin
31st August 2006, 11:00
After doing all modifications , code fixing at compilation i am getting



qgis: symbol lookup error: /usr/lib/qgis/libqgis_plugin_va.so: undefined symbol: _ZN12vARubberBandC1EP12QgsMapCanvas

resulting in QtFatalMsg.
I couldn't found the reason for this. I had checked my code but it looks normal.

jacek
31st August 2006, 11:03
Does your plugin use classes from the application?

quickNitin
31st August 2006, 11:18
yes, they do through inheritance which is inevitable.
Here vARubberBand class is defined at same level in heirarchy as plugin ( same placer also ).
I have a data member pointer to vARubberBand and create a object of it in constructor.



//! tool for drawing polygons
class vARubberBand *rubberBand;
//! add point to this list
std::vector<QgsPoint> mPoints;
//!

jacek
31st August 2006, 12:02
Either add -rdynamic to application's linker flags, or move all common classes to separate library and link both the application and the plugin with it. Note that the first solution won't work under windows.

Another solution is to use only interfaces in the plugin.

quickNitin
31st August 2006, 12:13
i followed first method but still receiving symbol lookup error. i have also tried declaring vARubberBand class in different namespace, just to avoid chance of redeclaration, but not succeeded.

jacek
31st August 2006, 12:21
How did you implement vARubberBand::vARubberBand(QgsMapCanvas*)?

quickNitin
31st August 2006, 12:27
vARubberBand::vARuberBand(QgsMapCanvas *mapCanvas):QgsMapCanvasItem(mapCanvas)
{
mPoints.push_back(QgsPoint());
QColor color=new QColor(Qt::LightGray);
QColor fillColor(color.red(),color.green(),color.blue(),6 3);
mPen.setColor(QColor(Qt::LightGray));
mBrush.setColor(fillColor);
mBrush.setStyle(Qt::solidPattern);
}

quickNitin
31st August 2006, 12:36
i am attaching in question code here

jacek
31st August 2006, 12:37
-rdynamic should go to compiler flags, not linker ones.

quickNitin
31st August 2006, 13:10
here i am presenting some part of makefile



CC = gcc
CCDEPMODE = depmode=gcc3
CFLAGS = -g -O2 -rdynamic
CPP = gcc -E
CPPFLAGS =
CXX = g++
CXXCPP = g++ -E
CXXDEPMODE = depmode=gcc3
CXXFLAGS = -g -O2 -rdynamic
CYGPATH_W = echo
.
.
.
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
.
.
.
.cpp.o:
if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
# source='$<' object='$@' libtool=no \
# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \
# $(CXXCOMPILE) -c -o $@ $<

quickNitin
31st August 2006, 13:17
vARubberBand::vARuberBand(QgsMapCanvas *mapCanvas):QgsMapCanvasItem(mapCanvas)
{
mPoints.push_back(QgsPoint());



found one typing error . It should had been vARubberBand ( 2 b) but i put vARuberBand(). compiling whole code again.

Shouldn't compiler detect it and atleast issue a warning

jacek
31st August 2006, 13:20
Shouldn't compiler detect it and atleast issue a warning
Yes, but only if the error was only in implementation.

wysota
1st September 2006, 00:21
-rdynamic should go to compiler flags, not linker ones.

AFAIR it should go to linker flags (it's the same as --export-dynamic).

jacek
1st September 2006, 00:57
it should go to linker flags (it's the same as --export-dynamic).
It is a compiler option, which tells it to pass --export-dynamic to the linker.

quickNitin
1st September 2006, 04:10
back to square one, after doing all these corrections again same error appears
:(
.

wysota
1st September 2006, 09:02
Did you try with exporting the symbols used in the plugin into a separate library?

quickNitin
1st September 2006, 09:30
no i hadnot. i don't know how to do that.

wysota
1st September 2006, 11:41
Create a subproject with lib template and put all the classes and functions you want to use in plugins (and remove them from the main project). Then tell the main project to link with the library (for example using LIBS+=-L pathtosubproject -lnameoflib). Do the same with all the plugins (I mean link them against the newly created library). Remember that this library has to be found by the dynamic loader when you start your main app (you can use LD_LIBRARY_PATH env variable to do that).

quickNitin
1st September 2006, 12:18
i will try to follow the steps.