未定义的符号错误

时间:2011-02-01 20:40:12

标签: java c++ c gcc arm

我是一名java开发人员,编译一些C ++代码来构建一个共享对象,以便用Java访问它。我可以成功构建我的'so'文件但是当我使用Java加载它时出现undefined symbol: _ZTI18TransportFormatter错误。我在代码中为这个符号做了一个grep,我发现符号是TcpFormatter.o and UdpFormatter.o的一部分。以下是我的make文件。如果我在这里丢失任何东西,请告诉我。

P.S:我正在ARM处理器上构建它。当我构建它并在常规的Linux x86上运行时,我没有问题。

先谢谢。


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

1 个答案:

答案 0 :(得分:1)

只是一个有根据的猜测,但看起来你的代码使用RTTI(_ZTI18TransportFormatter = typeinfo for TransportFormatter),或者直接通过调用dynamic_casttypeid,或者编译器/链接器无论如何都会包含它不要通过-fno-rtti选项明确禁用它,但这通常在嵌入式平台上不可用。