简体   繁体   中英

Visual Studio 2015: Build C++ 11 library for Android

I'm working on porting this digital logic library to 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. 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. 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. 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?

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. These settings will allow the code to compile:

Compiler: Clang 3.8

Use of STL: GNU STL Static library

C++ Language Standard: C++11

Linker Command Line Additional Options: -lm

The designation that made it work was the -lm linker option to ensure it was properly linking the math library.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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