开发者

Undefined Symbol Error

I am a java developer and compiling some C++ code to build a Shared Object to access it in Java. I can successfully build my 'so' file but when I load it using Java I get undefined symbol: _ZTI18TransportFormatter error. I did a grep for this symbol in my code and I found that the symbol is part of TcpFormatter.o and UdpFormatter.o. Following is my make file. Please tell me if I am missing anything here.

P.S: I am building this on ARM processor. When I build this and run on a regular linux x86, I have no problems.

Thanks in Advance.


LD_LIBRARY_PATH=/usr/lib/gcc/arm-linux-gnueabi/4.3.3/
JDK_HOME=/home/skolli/native/java/include
CC=gcc
CCFLAGS=-c -O2
INCLUDE_DIRS=-I$(JDK_HOME) -I$(JDK_HOME)/linux
LIBS=/usr/lib/libstdc++.so.6
OBJ= Clock.o Constants.o IpFullAddress.o IcmpFormatter.o IpHeaderFormatter.o TcpFormatter.o UdpFormatter.o IcmpEchoFormatter.o IcmpErrorFormatter.o NetworkHandler.o IcmpTransfer.o jni_util.o JniConnector.o

icmpTransfer:   $(OBJ)
    $(CC) $(INCLUDE_DIRS) $(LIBS) -shared -o libicmpTransfer.so $(OBJ)
Clock.o:        Clock.cpp Clock.h JniConnector.h
    $(CC) $(INCLUDE_DIRS) $(CCFLAGS) $*.cpp
Constants.o:        Constants.cpp Constants.h
    $(CC) $(INCLUDE_DIRS) $(CCFLAGS) $(FLAGS) $*.cpp
IcmpFormatter.o:        IcmpFormatter.cpp IcmpFormatter.h Constants.h
    $(CC) $(INCLUDE_DIRS) $(CCFLAGS) $*.cpp
IpHeaderFormatter.o:    IpHeaderFormatter.cpp IpHeaderFormatter.h Exception.h JniConnector.h
    $(CC) $(INCLUDE_DIRS) $(CCFLAGS) $*.cpp
TcpFormatter.o:         TcpFormatter.cpp TcpFormatter.h IpFullAddress.h IcmpFormatter.h
    $(CC) $(INCLUDE_DIRS) $(CCFLAGS) $*.cpp
UdpFormatter.o:     UdpFormatter.cpp UdpFormatter.h IpFullAddress.h TcpFormatter.h IcmpFormatter.h
    $(CC) $(INCLUDE_DIRS) $(CCFLAGS) $*.cpp
IcmpEchoFormatter.o:    IcmpEchoFormatter.cpp IpHeaderFormatter.h IcmpFormatter.h IpHeaderFormatter.h
    $(CC) $(INCLUDE_DIRS) $(CCFLAGS) $*.cpp
IcmpErrorFormatter.o:   IcmpErrorFormatter.cpp IcmpErrorFormatter.h IcmpEchoFormatter.h Exception.h IpHeaderFormatter.h IpFullAddress.h Exception.h JniConnector.h
    $(CC) $(INCLUDE_DIRS) $(CCFLAGS) $*.cpp
IpFullAddress.o:        IpFullAddress.cpp IpFullAddress.h Exception.h JniConnector.h
    $(CC) $(INCLUDE_DIRS) $(CCFLAGS) $*.cpp
NetworkHandler.o:       NetworkHandler.cpp NetworkHandler.h Clock.h IpFullAddress.h JniConnector.h
    $(CC) $(INCLUDE_DIRS) $(CCFLAGS) $*.cpp
IcmpTransfer.o:         IcmpTransfer.cpp IcmpTransfer.h IcmpFormatter.h IcmpEchoFormatter.h IcmpErrorFormatter.h IpHeaderFormatter.h NetworkHandler.h Clock.h TcpFormatter.h JniConnector.h UdpFormatter.h
    $(CC) $(INCLUDE_DIRS) $(CCFLAGS) $*.cpp
jni_util.o:         /home/skolli/native/share/TaCoreLib/jni_util.c /home/skolli/native/share/TaCoreLib/jni_util.h
    $(CC) $(INCLUDE_DIRS) $(CCFLAGS) $*.c
JniConnector.o:         JniConnector.cpp JniConnector.h ../TaCoreLib/jni_util.h com_attune开发者_开发百科_netally_ta_corelib_IcmpPacketTransfer.h Clock.h IcmpTransfer.h
    $(CC) $(INCLUDE_DIRS) $(CCFLAGS) $*.cpp


clean:
    -rm *.o


Just an educated guess but it looks like your code uses RTTI (_ZTI18TransportFormatter = typeinfo for TransportFormatter), either directly by calling dynamic_cast or typeid or the compiler/linker will include it anyway if you don't explicitly disable it via the -fno-rtti option, but that's usually not available on embedded platforms.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜