Android NDK:无法解析功能va_start/va_end [英] Android NDK: Function va_start / va_end could not be resolved
本文介绍了Android NDK:无法解析功能va_start/va_end的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图在我的项目中使用va_start和va_end函数,但是eclipse不想将其解析为函数. gcc编译整个项目而没有错误...
I trying to use va_start and va_end functions in my project, but eclipse don't want to resolve it as functions. gcc compiles whole project without errors...
[myfile.cpp]
[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);
}
[...]
[Android.mk]
[Android.mk]
[...]
LOCAL_C_INCLUDES := jni/pvrTools/ jni/igel/ $(STLPORT_BASE)/stlport
[...]
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
[...]
因此,看来Eclipse无法找到某些东西...如何解决此问题? 预先感谢!
So, it looks like Eclipse unable to locate something... How to solve this issue? Thanks in advance!
P.S.>项目->索引->重建无济于事. :(
P.S.> Project->Index->Rebuild didn't help. :(
推荐答案
我通过使用嵌入式编译器功能替换va_ *代码来解决此问题:
I solve this issue by replacing my va_* code with embedded compiler features:
#ifdef IGEL_PLATFORM_ANDROID
# define ShowDbgMsg(...) ((void)__android_log_print(ANDROID_LOG_INFO, "igel-debug", __VA_ARGS__))
#else
inline void ShowDbgMsg( const char* str, ... )
{
va_list argptr;
va_start(argptr, str);
vprintf(str, argptr);
va_end(argptr);
}
#endif // IGEL_PLATFORM_ANDROID
我知道这不是一个好的解决方案,但是它可以工作.
I know it's not a good solution, but it works.
这篇关于Android NDK:无法解析功能va_start/va_end的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文