__ANDROID__宏突然没有定义定义、突然

由网友(掩灼)分享简介:我工作的一个应用程序,它使用NDK(所有我在写事上都R6B和r8d)I'm working on an app which uses NDK (all I'm writing happened both on r6b and r8d)一切工作正常了,我想开始和尝试调试我的C code。Everything was...

我工作的一个应用程序,它使用NDK(所有我在写事上都R6B和r8d)

I'm working on an app which uses NDK (all I'm writing happened both on r6b and r8d)

一切工作正常了,我想开始和尝试调试我的C code。

Everything was working fine, and I wanted to start and try debugging my C code.

我跟着这个 http://tool​​s.android.com/recent/usingthendkplugin 教程, 但 NDK_DEBUG = 1 标记来生成命令,我突然开始在code甚至删除该标签后并没有消失收到错误,从安卓4.2变化0.2回到2.2,改变NDK我所用,或其他任何我能想到的。

I followed this http://tools.android.com/recent/usingthendkplugin tutorial, but NDK_DEBUG = 1 tag to my build command, suddenly I started getting errors in the code which didn't go away even after removing that tag, changing from Android 4.2.2 back to 2.2, changing the NDK I was using, or anything else I could think of.

该问题现在里面发生这样的语句

The problems happens now inside statements like this

#ifdef __ANDROID__
some cool android code
#else
some pretty awesome iOS code
#endif

会发生什么情况可以认为 __ ANDROID __ 由于某些原因不明确,造成日食和 NDK建造来试试并编译了iOS code,而不是Android的

what happens it that the __ANDROID__ is for some reason not define, causing eclipse and ndk-build to try and compile the iOS code instead of the Android's

复归我所做的一切都没有,似乎有什么影响。重新启动日食并没有为好。清洁项目,完全删除 OBJ 目录没有工作过。

Reverting everything I did didn't seems to have any effect. Restarting eclipse didn't as well. Cleaning the project, completely delete libs and obj directories didn't work too..

有什么建议?

谢谢!

编辑:

也许这是值得补充的构建本身,使用NDK建造成功完成。 我想可能是蚀问题,但即便如此,它仍然是一个错误,我不能启动应用程序

Maybe it's worth adding that the build itself, using ndk-build completes successfully. I think it might be an eclipse issue, but even if so, it still an error and I can't launch the app

此外,为了以防万一,重新启动计算机并没有擦出火花。

Also, just in case, restarting the computer didn't work either.

编辑2: 存在于所有运行相同的工作空间网络上的另一台计算机的问题,我的猜测是一些相关的工作区,所以我试图删除 .metadata 文件夹,然后再加入该项目。

EDIT 2: The problem exists on another computer running the same workspace over network, my guess was something related to the workspace, so I tried deleting .metadata folder and adding the project again.

删除 .metedata 文件夹固定它的第一时间,但几分钟后,(中,我成功地构建和在我的平板电脑上运行的应用程序)同样的问题回来了,删除 .metadata 没有工作

Deleting the .metedata folder fixed it the 1st time, but after a few minutes (in which I managed to build and run the app on my tablet) the same issue returned, and deleting the .metadata didn't work

修改3:

仍然没有去。

不过,我可以证实,这不是一个项目的具体问题,因为所有在日食的原生支持,现在做的项目。

However, I can confirm that it's not a project specific problem, as all the projects that has Native support in eclipse now do this.

其他的事情不工作:

创建一个空的项目,增加本机支持。 完全切换到另一个无关的工作区,并进行上述测试 在下载新的版本的Eclipse(JUNO), CDT &放大器; ADT (已使用Eclipse ADT包) creating an empty project, adding Native support. Completely changing to another unrelated workspace and perform the above tests Downloading fresh version of eclipse (juno), CDT & ADT (was using the eclipse ADT bundle)

推荐答案

如果任何人遇到这个问题:

If anyone else encounters this issue:

我打开了工作区的另一台计算机(工作区是在Dropbox的文件夹),问题仍然存在另一台计算机,这只能意味着一个工作空间的问题,所以我从工作区中删除.metadata文件夹。

I opened the workspace on another computer (Workspace is in a Dropbox folder), and the problem was still there on the other computer, which could only mean a workspace issue, so I delete the .metadata folder from the workspace.

我不得不重新添加该项目,但这样做之后,一切似乎现在的工作。

I had to re-add the projects, but after doing so, everything seems to work now.

    Copyright 2016-2020 新思维的学习:__ANDROID__宏突然没有定义定义、突然、All Right Reserved 浙ICP备20029812号-1