这里有几个问题。首先,包括cstdarg会抛出此错误:
/usr/include/c++/4.2.1/cstdarg:59:11:{60:9-60:11}: error: no member named 'va_list' in the global namespace [3]
using ::va_list;
然后,包括c ++ locale.h引发了这个:
/usr/include/c++/4.2.1/bits/c++locale.h:76:5: error: use of undeclared identifier 'va_start' [3]
va_start(__args, __fmt);
^
/usr/include/c++/4.2.1/bits/c++locale.h:84:5: error: use of undeclared identifier 'va_end' [3]
va_end(__args);
^
/usr/include/c++/4.2.1/cstdarg:54:20: note: instantiated from:
#define va_end(ap) va_end (ap)
我不知道该怎么做。我使用的是SFML 2.0,包括Graphics.hpp会产生这些错误。任何想法如何解决这个问题?
答案 0 :(得分:3)
我遇到了同样的问题。我发现在我的标题搜索路径中同时包含/usr/local/include/**
和/usr/include/**
会破坏所有标准模板库。我使用的其中一个库在/usr/lib
和/usr/include
安装了自我,我发现卸载此库并将其重新安装到/usr/local/lib
和/usr/local/include
解决了这个问题。
我尝试按照上面的建议添加stdio.h
,但它没有帮助。
我使用的系统是Mac OS 10.8和XCode 4.3
答案 1 :(得分:1)
普通C标头与C ++标头不兼容。请尝试添加cstdarg
代替stdarg.h
答案 2 :(得分:1)
我在一个项目上遇到了这个问题并通过在开头添加一个额外的include来修复它,这个include负责在缺少的元素中加载:
#include <stdio.h>
如果你查看该文件,你会看到定义:
#ifndef _VA_LIST
#define _VA_LIST
/* DO NOT REMOVE THIS COMMENT: fixincludes needs to see:
* __gnuc_va_list and include <stdarg.h> */
typedef __darwin_va_list va_list;
#endif