How to use curl Nuget package in C++ application

后端 未结 1 956
悲&欢浪女
悲&欢浪女 2021-02-06 17:31

I am trying to use curl in a C++ application I am developing using Visual Studio 2017. I like the idea of using Nuget because it is a very clean way of implementing a library. I

1条回答
  •  你的背包
    2021-02-06 18:05

    How to use curl Nuget package in C++ application

    Since you are using the curl package, you will notice that there are only two lib versions for Visual Studio: v100 & v110:

    The curl package should only work fine on Visual studio V100 and V110. I tested your sample code with the curl package on Visual Studio 2010 and 2012, and it worked fine.

    So this package is not compatible with VS 2015 & VS 2017 (VS 2017 uses toolset v141 and the package only supports v110 and v120). If you want to use this package on Visual Studio 2015 and 2017, you can change the toolset to a previous one. Go into Project Properties->General->Platform Toolset, and change it to Visual Studio 2010 (v100). (You will need to install the VS2010 or VS 2012) Test it and confirm it works fine.

    If you don't want to install VS2010 or VS2012, you can try to use the rmt_curl package instead, but there are some points you need to pay attention to, otherwise you will not get it to work.

    For VS2015, after you install the package rmt_curl, you will notice that the curl.h exists in the External Dependencies:

    So just use #include instead of #include to include the header file. After using #include , the project built fine in my Visual Studio 2015.

    For Visual Studio 2017, rmt_curl does not work, but you can change the toolset to Visual Studio 2015 (v140) (You'll Need install Microsoft Build Tools 2015 or VS 2015). It works for me.

    Hope that this mess of answer doesn't bother you. It seems that the curl package is not perfect, so we should pay more attention when using it so it can become more perfect.

    Hope the above info can help you, and if you have any doubts about this solution, please let me know.

    0 讨论(0)
提交回复
热议问题