c++ - XCode 升级到 4.4.1,现在我在 STL <vector> 中编译时遇到错误

标签 c++ xcode

升级到 XCode 4.4.1 并重新启动我的机器,重新编译,现在当我尝试编译时出现以下错误 - 有什么建议吗? (它曾经编译得很好) (在 Lion 10.7.4 上运行,XCode 版本 4.4.1)

#ifndef MYFILE_H
#define MYFILE_H

#include <vector> <-- this line
#include <typeinfo>
#include <string>
#include "assert.h"

using namespace std;

错误信息

In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/usr/include/c++/4.2.1/vector:69:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/usr/include/c++/4.2.1/bits/stl_vector.h:69:1: error: expected member name or ';' after declaration specifiers
_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)

最佳答案

如果这个问题仍然存在,我建议您检查以下项目设置行:

  • C++ 语言方言(我的:编译器默认)
  • C++ 标准库(我的:编译器默认)
  • C/C++/Objective-C 编译器(我的:Apple LLVM 编译器 4.1)

并非所有组合都有效,而且“编译器默认值”并非总是默认值。我也遇到了一些问题。

(从错误消息中它看起来像你使用的是 libstdc++ 而不是 libc++ 但不是 gcc 编译器等等。更新后我遇到了类似的问题。)

关于c++ - XCode 升级到 4.4.1,现在我在 STL <vector> 中编译时遇到错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12211000/

相关文章:

c++ - 打印 vector 的 vector

c++ - 一遍又一遍地重新定义变量是否会增加内存?

javascript - 如何识别 FlipBoard 或 MobileRss 中的自定义 UIWebView

iphone - 为什么 XCode 每次都会将资源复制到 iDevice,即使它们仍未更改?

iphone - JSONKIt 序列化 NSDIctionary

objective-c - 不使用 openURL :url 打开 Mobile Safari

c++ - 查找数组中的最小数字

c++ - 抽象指向成员函数的指针 : safety and alternatives

c++ - C++中的复制构造函数

ios - 在 Windows 机器上压缩后的预期标识符或 '('