【发布时间】:2013-02-07 10:51:22
【问题描述】:
操作系统:OS X 10.8.1 QtCreator:2.6.2
命令行很好,但是QtCreator编译代码失败。
#include <functional>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
int main(int argc, const char * argv[])
{
std::vector<std::string> strs{"yahoo", "haha"};
for(auto const &data : strs){
std::cout<<data<<std::endl;
}
std::vector<std::string> strs2 = std::move(strs);
std::unique_ptr<int> A(new int(3));
std::cout<<*A<<std::endl;
return 0;
}
命令行:
clang++ -stdlib=libc++ -std=c++11 main.cpp -o test
QtCreator的编译器设置 http://www.flickr.com/photos/92283971@N04/8453188038/in/photostream
Qt .pro 文件
TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt
SOURCES += main.cpp
QMAKE_CXXFLAGS += -std=c++11
QMAKE_CXXFLAGS += -stdlib=libc++
错误信息:
clang:错误:-stdlib=libc++ 的部署目标无效(需要 OS X 10.7 或更高版本)make: *** [main.o] 错误 1
但我的操作系统号是 10.8.1
【问题讨论】:
标签: clang++