【发布时间】:2015-11-23 21:17:58
【问题描述】:
Boost 并不真正关心 android 开发,所以我决定与其拼命尝试为 android 获取 boost 的静态库,不如随我的程序一起构建 boost 源。
我为我的构建添加了这个定义:
DEFINES += BOOST_ALL_NO_LIB
我添加了库和.cpp 文件:
boost155/libs/system/src/error_code.cpp \
boost155/libs/thread/src/pthread/once.cpp \
boost155/libs/thread/src/pthread/once_atomic.cpp \
boost155/libs/thread/src/pthread/thread.cpp \
boost155/libs/thread/src/future.cpp \
boost155/libs/thread/src/tss_null.cpp \
boost155/libs/iostreams/src/file_descriptor.cpp \
boost155/libs/iostreams/src/gzip.cpp \
boost155/libs/iostreams/src/mapped_file.cpp \
boost155/libs/iostreams/src/zlib.cpp \
boost155/libs/chrono/src/chrono.cpp \
boost155/libs/chrono/src/process_cpu_clocks.cpp \
boost155/libs/chrono/src/thread_clock.cpp \
boost155/libs/date_time/src/gregorian/date_generators.cpp \
boost155/libs/date_time/src/gregorian/greg_month.cpp \
boost155/libs/date_time/src/gregorian/greg_weekday.cpp \
boost155/libs/date_time/src/gregorian/gregorian_types.cpp \
boost155/libs/date_time/src/posix_time/posix_time_types.cpp
boost155/libs/filesystem/src/codecvt_error_category.cpp \
boost155/libs/filesystem/src/operations.cpp \
boost155/libs/filesystem/src/path.cpp \
boost155/libs/filesystem/src/path_traits.cpp \
boost155/libs/filesystem/src/portability.cpp \
boost155/libs/filesystem/src/unique_path.cpp \
boost155/libs/filesystem/src/utf8_codecvt_facet.cpp \
头文件的包含方式与普通 PC 构建相同:
INCLUDEPATH += ../libs/boost155/
项目编译没有错误,但在链接期间我收到链接器错误:
./libs/boost155/boost/system/error_code.hpp:323: error: undefined reference to 'boost::system::system_category()'
../libs/boost155/boost/thread/exceptions.hpp:51: error: undefined reference to 'boost::system::system_category()'
../libs/boost155/boost/asio/error.hpp:224: error: undefined reference to 'boost::system::system_category()'
../libs/boost155/boost/system/error_code.hpp:222: error: undefined reference to 'boost::system::generic_category()'
../libs/boost155/boost/system/error_code.hpp:223: error: undefined reference to 'boost::system::generic_category()'
../libs/boost155/boost/system/error_code.hpp:224: error: undefined reference to 'boost::system::system_category()'
../libs/boost155/boost/chrono/detail/inlined/posix/chrono.hpp:59: error: undefined reference to 'boost::system::throws'
../libs/boost155/boost/chrono/detail/inlined/posix/chrono.hpp:113: error: undefined reference to 'boost::system::throws'
../libs/boost155/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp:118: error: undefined reference to 'boost::system::throws'
../libs/boost155/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp:194: error: undefined reference to 'boost::system::throws'
我错过了什么.cpp?
【问题讨论】: