android - Crystax 建造谷神星时遇到的错误
问题描述
当我使用 Crystax ndk 构建 Ceres-Solver 时,我更改了
APP_STL := c++_static
至
APP_STL := gnustl_static
因为 gnustl_static 与 android 上的 OpenCV 兼容,所以我有 libceres.a,我将它复制到项目 jni 文件夹并将以下行添加到 Applications.mk
然后我使用 Crystax ndk 运行 ndk-build(我将 Crystax 文件夹添加到系统路径)
LOCAL_LDLIBS += libceres.a
LOCAL_SRC_FILES += Test.cpp
使用 Ceres 的 test.cpp 的一部分如下:
struct CostFunctor {
template <typename T>
bool operator()(const T* const x, T* residual) const {
residual[0] = T(10.0) - x[0];
return true;
}
};
int main(int argc, char** argv) {
double x = 0.5;
const double initial_x = x;
Problem problem;
CostFunction* cost_function =
new AutoDiffCostFunction<CostFunctor, 1, 1>(new CostFunctor);
problem.AddResidualBlock(cost_function, NULL, &x);
Solver::Options options;
options.minimizer_progress_to_stdout = true;
Solver::Summary summary;
Solve(options, &problem, &summary);
return 0;
}
然后事情就出错了(发出的错误信息越多):
/home/panxiaoyu/ceres-solver/jni/../internal/ceres/miniglog/glog/logging.h:174: error: undefined reference to 'std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >::basic_stringstream(std::_Ios_Openmode)'
/opt/crystax-ndk/sources/cxx-stl/gnu-libstdc++/5/include/bits/basic_string.h:544: error: undefined reference to 'std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_stringstream()'
/opt/crystax-ndk/sources/cxx-stl/gnu-libstdc++/5/include/sstream:766: error: undefined reference to 'std::__cxx11::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::str() const'
哪里错了?
是我的 ndk 配置错误还是 Crystax 有错误?
解决方案
推荐阅读
- php - 发送 smtp 邮件 laravel 不工作
- java - 登录 Facebook 后 Android webView 不回来?
- amazon-web-services - 捕获 S3 文件下载开始和结束时间以及其他详细信息
- azure - 如何通过 Azure DevOps 从 Azure 中删除存储帐户
- xamarin - 带有 Xamarin 应用程序的 VS2017 和 Win7 中的命名空间问题?
- java - Maven 无法使用 OpenJDK 11 找到 jaxb-api,即使它存在于存储库中
- javascript - 画布触觉 JS
- docker - Docker 没有重新启动
- c# - 全尺寸图像的用户控件
- node.js - 尝试在生产模式下编译时 webpack 失败