C++工具之NuGet库管理

使用VS中的NuGet可以方便的管理库,比如Boost、openssl等,就不需要去网上下载安装了,使用方便,

(1)首先在VS中安装NuGet,Tools->Extensionsand Updates…,Online搜索nuget,安装即可。



(2)使用NuGet库管理器安装需要的库。



(3)就能在你的代码中使用这些库了。

#include <iostream>
#include <boost/filesystem.hpp>

int main(int argc, char* argv[])
{
    if (argc < 2)
    {
        std::cout << "Usage: tut1 path\n";
        return 1;
    }
    std::cout << argv[1] << " " << boost::filesystem::file_size(argv[1]) << '\n';
    return 0;
}

(4)使用NuGet,会在项目文件夹中产生packages.config文件,就是NuGet安装库,并且在项目编译过程中VS会自动将需要的库进行下载,添加include和lib等操作,可在test.vcxproj文件中找到NuGet的操作。


猜你喜欢

转载自blog.csdn.net/qccz123456/article/details/80243867
今日推荐