Mac上安装boost, Xcode中使用

时间:2020-12-16 12:34:08   收藏:0   阅读:3

参考了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;
}

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!