升级到 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/