0

我正在使用 NDK 构建并看到这个奇怪的链接器错误:

./external/stlport/stlport/stl/_fstream.c:139: error: undefined reference to 'std::_Filebuf_base::_M_seek(long long, int)'
./external/stlport/stlport/stl/_fstream.c:391: error: undefined reference to 'std::_Filebuf_base::_M_seek(long long, int)'
./external/stlport/stlport/stl/_fstream.c:120: error: undefined reference to 'std::_Filebuf_base::_M_unmap(void*, long long)'
./external/stlport/stlport/stl/_fstream.c:320: error: undefined reference to 'std::_Filebuf_base::_M_seek(long long, int)'
./external/stlport/stlport/stl/_fstream.c:336: error: undefined reference to 'std::_Filebuf_base::_M_seek(long long, int)'
./external/stlport/stlport/stl/_fstream.c:120: error: undefined reference to 'std::_Filebuf_base::_M_unmap(void*, long long)'
./external/stlport/stlport/stl/_fstream.c:120: error: undefined reference to 'std::_Filebuf_base::_M_unmap(void*, long long)'
./external/stlport/stlport/stl/_fstream.c:120: error: undefined reference to 'std::_Filebuf_base::_M_unmap(void*, long long)'
collect2: error: ld returned 1 exit status

我得到了 fstream.o 的 objdump 输出,我确实看到了这个 _M_seek() 函数。任何想法为什么它仍然无法找到它。以下是我的 Android.mk 中的一些条目:

LOCAL_C_INCLUDES +=     $(TOP)/external/stlport/stlport \
                        $(TOP)/bionic/libstdc++/include \
                        $(TOP)/bionic \

LOCAL_CFLAGS += -std=gnu++11 -std=c++11

LOCAL_CPPFLAGS := -std=gnu++11 -std=c++11

LOCAL_SHARED_LIBRARIES := libcutils liblog libutils libstlport

我错过了什么吗?

4

1 回答 1

0

查看您是否在 Android.mk 文件中定义了 _LARGEFILE_SOURCE。如果它已经被定义,删除它可以解决问题。

于 2016-07-24T15:33:00.847 回答