简体   繁体   English

如何在 Visual Studio 上使用库?

[英]How can I use a library on Visual Studio?

I am trying to use cpr library but I cannot use it properly probably because I can't include the library properly.我正在尝试使用 cpr 库,但我无法正确使用它,可能是因为我无法正确包含该库。 I tried other libraries like curlpp or plain curl, but every time I tried, I got errors like this:我尝试了其他库,如 curlpp 或普通 curl,但每次尝试时,我都会遇到这样的错误:

cpr::Session::Session(void)" (??0Session@cpr@@QAE@XZ), "class cpr::Response __cdecl cpr::Get,class std::allocator >,class cpr::Authentication,class cpr::Parameters>(class std::basic_string,class std::allocator > &&,class cpr::Authentication &&,class cpr::Parameters &&)" (??$Get@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@VAuthentication@cpr@@VParameters@4@@cpr@@YA?AVResponse@0@$$QAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@$$QAVAuthentication@0@$$QAVParameters@0@@Z) cpr::Session::Session(void)" (??0Session@cpr@@QAE@XZ), "class cpr::Response __cdecl cpr::Get,class std::allocator >,class cpr::Authentication,class cpr::Parameters>(class std::basic_string,class std::allocator > &&,class cpr::Authentication &&,class cpr::Parameters &&)" (??$Get@V?$basic_string@DU?$char_traits @D@std@@V?$allocator@D@2@@std@@VAuthentication@cpr@@VParameters@4@@cpr@@YA?AVResponse@0@$$QAV?$basic_string@DU?$char_traits@ D@std@@V?$allocator@D@2@@std@@$$QAVAuthentication@0@$$QAVParameters@0@@Z)

I think I got this error because of my method of including classes.我想我收到这个错误是因为我的包含类的方法。 I need to know how to use these classes with Visual Studio 2017. I searched everywhere but probably because I don't know what exactly I need to look, I couldn't find anything.我需要知道如何在 Visual Studio 2017 中使用这些类。我到处搜索,但可能是因为我不知道我到底需要看什么,我找不到任何东西。 Here is the library I want to use: https://whoshuu.github.io/cpr/这是我想使用的库: https : //whoshuu.github.io/cpr/

The solution is learning how to use this kind of libraries with Visual Studio.解决方案是学习如何在 Visual Studio 中使用此类库。 This is where I need help.这是我需要帮助的地方。

This might help you with VS 2017这可能会帮助您使用 VS 2017

#pragma comment(lib, "Your library name here") 

Add it to your source.将其添加到您的来源。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM