简体   繁体   English

Visual Studio 2015:为Android生成C ++ 11库

[英]Visual Studio 2015: Build C++ 11 library for Android

I'm working on porting this digital logic library to Android. 我正在将该数字逻辑库移植到Android。 However, I keep getting build errors involving missing functions from standard libraries like CMath, or missing C++11 libraries when trying to compile the Android project. 但是,在尝试编译Android项目时,我总是遇到涉及到诸如CMath之类的标准库中缺少功能或缺少C ++ 11库的生成错误。 Searching has revealed that issues with building C++ for Android in Visual Studio are rather common, but none of the suggestions I have found so far have helped. 搜索显示,在Visual Studio中为Android构建C ++的问题相当普遍,但是到目前为止,我发现的建议都没有帮助。 Here is the project with the build errors. 是带有构建错误的项目。

I have tried changing the target platform, changing the platform toolset, and changing the use of STL. 我尝试过更改目标平台,更改平台工具集以及更改STL的用法。 Various combinations of the settings. 设置的各种组合。 I can't seem to get anything building. 我似乎什么都没建。

Should I just give up on Visual Studio for my mobile C++ code and build those libraries elsewhere? 我是否应该只为移动C ++代码放弃Visual Studio而在其他地方构建那些库?

After creating a new branch with only Android code (as opposed to the previous cross platform mobile branch) and further playing with settings and searching, I arrived at the solution. 在创建仅包含Android代码的新分支(与之前的跨平台移动分支相对)并进一步进行设置和搜索之后,我得出了解决方案。 These settings will allow the code to compile: 这些设置将允许代码编译:

Compiler: Clang 3.8 编译器:Clang 3.8

Use of STL: GNU STL Static library STL的使用:GNU STL静态库

C++ Language Standard: C++11 C ++语言标准:C ++ 11

Linker Command Line Additional Options: -lm 链接器命令行的附加选项:-lm

The designation that made it work was the -lm linker option to ensure it was properly linking the math library. 使它起作用的名称是-lm链接器选项,以确保它正确链接了数学库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM