Mac上安装boost, Xcode中使用

参考了https://www.cnblogs.com/kolane/p/12057744.html

使用终端安装

用Xcode新建C++项目

需要配置一下boost的路径

 

完了就能正常使用:

#include <iostream>
#include <boost/lambda/lambda.hpp>
#include <boost/timer.hpp>


int fun(int n){
    if (n<=1) {
        return n;
    }
    return fun(n-1)+fun(n-2);
}

int main(int argc, const char * argv[]) {
    // insert code here...
    std::cout << "Hello, World!\n";
    
    fun(40);
    
    boost::timer tm;
        std::cout << tm.elapsed() << std::endl;
    
    
    
    return 0;
}

 

posted @ 2020-12-11 10:19  liuw_flexi  阅读(221)  评论(0编辑  收藏  举报