草庐IT

c++ - XCode boost "Semantic Issue - undeclared identifier va_start"

coder 2023-11-12 原文

C++locale.h
->Semantic Issue
-->Use of undeclared identifier 'va_start'
->Semantic Issue
-->Use of undeclared identifier 'va_end'

第一次使用 boost,使用 ports 下载它并在 XCode 中创建了一个命令行项目。 header 搜索路径:/usr/include/**

代码里什么都没有,只有默认proj自带的main函数。

只是不知道该怎么办,没想到会这样。

编辑1:

第一次出现:

#ifndef _GLIBCXX_CSTDARG
#define _GLIBCXX_CSTDARG 1

#pragma GCC system_header

#include <bits/c++config.h>
#include <stdarg.h>

// Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998
#ifndef va_end
#define va_end(ap) va_end (ap)
#endif

_GLIBCXX_BEGIN_NAMESPACE(std)

  using ::va_list;

_GLIBCXX_END_NAMESPACE

#endif

这是一个在\usr\include\c++\4.2.1 中没有扩展名的文件,我刚刚意识到这个文件与 boost 无关,这里发生了一些令人讨厌的事情。

EDIT2:将 include 目录修复到/opt/local/include/** 后出现新错误:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/type_traits:214:46:
Use of undeclared identifier 'nullptr_t'; did you mean 'nullptr'?

还有其他错误,都与文件夹 sr/lib/c++/v1/中的这些文件有关,这是为什么?这些文件似乎是一些核心功能,它们不能被破坏。

这是错误的图片,也许你们看到了什么

EDIT3:将编译器从 Apple LLVM 更改为 GCC LLVM 将错误减少到只有一个: c++locale.h 中的“vspintf 不是‘std’的成员”。好吧,现在我完全迷路了。

最佳答案

我遇到了同样的问题,我已经用自制软件安装了 Boost,当我在 XCode 中添加“Header Search Path”(/usr/local/Cellar/boost/1.54.0/include 和递归选项)时,构建抛出这些错误。

为了解决这个问题,我将“标题搜索路径”中的递归选项更改为非递归选项,它起作用了。

关于c++ - XCode boost "Semantic Issue - undeclared identifier va_start",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12573271/

有关c++ - XCode boost "Semantic Issue - undeclared identifier va_start"的更多相关文章

随机推荐