//
// main.cpp
// yyyy
//
// Created by yyyy on 2/6/13.
// Copyright (c) 2013 yyyy. All rights reserved.
//
#include <functional>
#include <iostream>
#include <initializer_list>
#include <memory>
#include <string>
#include <vector>
template<typename T>
inline void print_comma_separated_list(T value)
{
std::cout<<value<<std::endl;
}
template<typename First,typename ... Rest>
void print_comma_separated_list(First first,Rest ... rest)
{
std::cout<<first<<",";
print_comma_separated_list(rest...);
}
constexpr int multiply_two(int a)
{
return a * 2;
}
void initial(std::initializer_list<int> l)
{
if(std::begin(l) == std::end(l)){
}
}
int main()
{
// insert code here...
std::cout << "Hello, World!"<<std::endl;
std::shared_ptr<int> shr = std::make_shared<int>(10);
std::cout<<*shr<<std::endl;
auto func = [](){ std::cout << "hahaha\n"; };
func();
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);
for(auto const &data : strs2){
std::cout<<data<<std::endl;
}
std::unique_ptr<int> A(new int(3));
std::cout<<*A<<", wahaha"<<std::endl;
print_comma_separated_list(32, "444", 34.564564, "lalamimilolipo");
return 0;
}
.pro file
TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt
SOURCES += main.cpp
LIBS += -stdlib=libc++
QMAKE_CXXFLAGS += -stdlib=libc++
QMAKE_CXXFLAGS += -std=c++11
QMAKE_CXXFLAGS += -mmacosx-version-min=10.7
QMAKE_LFLAGS += -mmacosx-version-min=10.7
如果clang++太旧了,可以用macport下载比较新的版本
port search clang //搜寻clang的版本
sudo port install [clang版本]
这原本是我发在
http://bbs.csdn.net/topics/390366089
这一帖上的问题,原本想直接在那一贴上说明我已经找到解答了
可是由于无法连续回答三次,我只好另外开个帖子
利用上面的解法,会遇到一个warning
ld: warning: directory not found for option '-F/Users/yyyy/Qt5.0.1/5.0.1/clang_64/qtbase/lib'
这个warning是Qt5的bug,就算不管他也不会有什么大碍的样子,希望下一版本的Qt可以修正过来
------解决方案--------------------