Android NDK:函数va_start/va_end无法解析

Tut*_*men 4 android android-ndk

我试图在我的项目中使用va_start和va_end函数,但是eclipse不想将其解析为函数.gcc编译整个项目没有错误......

[MYFILE.CPP]

#include <stdio.h>
#include <stdarg.h>
[...]
inline void ShowDbgMsg( const char* str, ... )
{
    va_list argptr;
    va_start(argptr, str);
    vprintf(str, argptr);
    va_end(argptr);
}
[...]
Run Code Online (Sandbox Code Playgroud)

[Android.mk]

[...]
LOCAL_C_INCLUDES := jni/pvrTools/ jni/igel/ $(STLPORT_BASE)/stlport
[...]
Run Code Online (Sandbox Code Playgroud)

Eclipse说:

[...]
Description Resource    Path    Location    Type
Function 'va_start' could not be resolved   igel.comdef.h   /NativeProject/jni/igel    line 195 Semantic Error
Function 'va_end' could not be resolved igel.comdef.h   /NativeProject/jni/igel  line 203   Semantic Error
Function 'va_start' could not be resolved   igel.string.h   /NativeProject/jni/igel line 341    Semantic Error
Function 'va_end' could not be resolved igel.string.h   /NativeProject/jni/igel line 351    Semantic Error
[...]
Run Code Online (Sandbox Code Playgroud)

所以,看起来Eclipse无法找到某些东西......如何解决这个问题?提前致谢!

PS>项目 - >索引 - >重建没有帮助.:(

小智 7

我的解决方案也不漂亮.但是,在删除错误标记100次之后,请在包含stdlib.h之前将此代码放在某处.然后在Project :: Properties :: C++ General :: Paths and Symbols中定义ECLIPSEBUILD = 1.

  

    #if ECLIPSEBUILD // this part is just to fix spurious Eclipse errors
    typedef __builtin_va_list va_list;
    #define va_start(v,l)   __builtin_va_start(v,l)
    #define va_end(v)   __builtin_va_end(v)
    #define va_arg(v,l) __builtin_va_arg(v,l)
    #if !defined(__STRICT_ANSI__) || __STDC_VERSION__ + 0 >= 199900L || defined(__GXX_EXPERIMENTAL_CXX0X__)
    #define va_copy(d,s)    __builtin_va_copy(d,s)
    #endif
    #define __va_copy(d,s)  __builtin_va_copy(d,s)
    typedef __builtin_va_list __gnuc_va_list;
    typedef __gnuc_va_list va_list;
    typedef va_list __va_list;
    #endif