在eclipse上寫ndk程序,常常會出現莫名其妙的不能識別錯誤,程序不能編譯經過,即使把ndk帶有的頭文件加進來也不行。可是在命令行下,這是能夠編譯經過的。android
查了老外的博客eclipse
How to remove android NDK support from eclipse projectide
Today I've got stuck with pretty much weird errors in eclipse while trying to use ccache and android ndk-build. post
Apart from the fact that compiling was not successful, eclipse showed me dozens of errors which were complete nonsense. However, when I tried to compile project in cygwin console by calling ndk-build, everything well smoothly (well, not at the first time - see my next posts if you are having "Permission denied" error for accessing to some prebuilt libraries, or if you are having problems with undefined classes which are defined in std:: namespace). ui
But, if I tried to run program in eclipse - project run failed because of NDK errors. So, I've found a simple solution:spa
a) All NDK code build using command line and ndk-build all.命令行
b) Close eclipse, open project root, and delete .cproject file - you will remove C++ support from the projectcode
c) Use eclipse for everything else.ip
============
rem
總得來講就是ndk的代碼不用ide,直接在命令行下編譯
-------只是刪了.cproject是不行的,還要修改.project文件,把org.eclipse.cdt的屬性都刪掉-----by jackson ke