libcurl静态编译库使用

来源:互联网 发布:juniper mac 编辑:程序博客网 时间:2024/04/27 17:49

在使用静态库的时候,出现一下错误

error LNK2001: unresolved external symbol __imp__curl_easy_perform
error LNK2001: unresolved external symbol __imp__curl_easy_setopt
error LNK2001: unresolved external symbol __imp__curl_easy_init
error LNK2001: unresolved external symbol __imp__curl_easy_cleanup

解决办法:

项目属性->C/C++->Preprocessor->Definitions 增加:BUILDING_LIBCURL


#include "curl/curl.h"
#pragma comment(lib, "libcurl.lib")
#pragma comment(lib, "ws2_32.lib")
#pragma comment(lib, "winmm.lib")
#pragma comment(lib, "wldap32.lib")

0 0