Visual Studio 2017 Android NDK math.h [英] Visual Studio 2017 Android NDK math.h

查看:391
本文介绍了Visual Studio 2017 Android NDK math.h的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Android NDK将一些OpenGL ES代码从Windows移植到Android.我正在使用Visual Studio 2017和C ++.到目前为止,我在VS中创建了一个跨平台的gles项目,并删除了ios数据.我将一个代码文件放在另一个文件中,然后尝试修复所有我能找到的错误.

I'm trying to port some OpenGL ES code from windows to Android using the Android NDK. I'm using Visual Studio 2017 and C++. What I did so far, I created a cross platform gles project in VS and removed the ios data. I'm putting one code file after the other and try to fix any errors I can find.

我遇到的问题是,似乎找不到math.h函数.

The issue I have is that is seems that math.h functions can't be found.

以下是一些可能相关的信息:

Here's some information that might be relevant:

  • 平台工具集是clang 3.8
  • 目标API级别为android-21
  • 语言标准是c ++ 11
  • 我已添加m;作为链接器库依赖项的选项
  • Platform toolset is clang 3.8
  • Target API Level is android-21
  • Language standard is c++11
  • I have added m; as an option to linker library dependencies

如果我包含math.h,我会得到:

If i include math.h I get:

使用未声明的标识符'sqrt'(以及我正在使用的所有其他math.h函数)

use of undeclared identifier 'sqrt' (and all the other math.h functions I'm using)

如果我包含cmath,我会得到:

If i include cmath I get:

全局名称空间(以及所有其他cmath函数)中没有成员名称为"acos"

no member names 'acos' in the global namespace (and all the other cmath functions)

文件的路径(由Visual Studio找到):

Path for files (as found by Visual Studio):

c:\ProgramData\Microsoft\AndroidNDK64\android-ndk-r13b\platforms\android-21\arch-x86\usr\include\math.h

c:\ProgramData\Microsoft\AndroidNDK64\android-ndk-r13b\sources\cxx-stl\gnu-libstdc++\4.9\include\cmath

如果我删除所有数学调用,它将编译.

If I remove all math calls, it compiles.

有人在这种情况下设法使用cmath吗?如果是这样,您有任何提示或指向我在做什么错吗?

Has anyone managed to use cmath in this context? If so, do you have any tips or point to what am I doing wrong?

谢谢.

推荐答案

我没有找到问题的解决方法,但是从本机android模板创建项目后,您可以毫无错误地使用cmath,但是您确实需要在链接器输入中添加m;.

I have not found a fix to the questions, but creating a project from the native android template allows you to use cmath without error, but you do need to add m; in linker input.

这篇关于Visual Studio 2017 Android NDK math.h的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆