【问题标题】:Assuming GCC and G++ are installed how to compile a file which uses boost library? (threading)假设安装了 GCC 和 G++,如何编译使用 boost 库的文件? (穿线)
【发布时间】:2010-12-25 23:37:06
【问题描述】:

所以我是 linux 的新手。我已经设置了 linux Debian,我已经安装了 gcc。我有一个使用 boost 线程库的简单 C++ 文件。让我们将该文件称为 example.cpp,我们有它的确切路径。如何编译它? (对不起,我来自 windows 世界=)

【问题讨论】:

    标签: c++ linux gcc compiler-construction g++


    【解决方案1】:

    假设example.cpp 在当前目录中,这将创建一个名为example 的可执行文件,链接到boost-thread。 g++ 将在系统库位置搜索库。

    g++ example.cpp -lboost-thread -o example

    【讨论】:

    • 如果没有安装,它会为我下载 boost 吗?
    • 哦,不,我假设已安装 boost-thread:要安装 boost 库,您需要执行类似 sudo apt-get install libboost-dev 的操作
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-12-04
    • 1970-01-01
    • 1970-01-01
    • 2012-07-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多