gpt4 book ai didi

c++ - 在 vs2008 中使用 CurlPP

转载 作者:可可西里 更新时间:2023-11-01 16:22:03 25 4
gpt4 key购买 nike

我正在尝试使用静态 curlpp 库在 VS2008 中构建一个 C++ 控制台应用程序。代码 - 这是 curlpp 示例 00 - 如下所示:

#include "stdafx.h"


#include <curlpp/curlpp.hpp>
#include <curlpp/Easy.hpp>
#include <curlpp/Options.hpp>


using namespace curlpp::options;

int main(int, char **)
{
try
{

// Our request to be sent.
curlpp::Easy myRequest;

// Set the URL.
myRequest.setOpt<Url>("http://example.com");

// Send request and get a result.
// By default the result goes to standard output.
myRequest.perform();
}

catch(curlpp::RuntimeError & e)
{
std::cout << e.what() << std::endl;
}

catch(curlpp::LogicError & e)
{
std::cout << e.what() << std::endl;
}

return 0;
}

我已经下载了源代码并将我的包含路径指向源包含文件,但是当我尝试编译时,我在类型的内联文件中遇到了一大堆错误:

不允许定义 dllimport 函数

肯定有很多人在 vs2008 中使用了 curlpp,但我遗漏了一些明显的东西。

最佳答案

查看 \include\curlpp\internal\buildconfig.h 文件,其中定义了以下宏

CURLPPAPI
CURLPP_INCLUDE_TEMPLATE_DEFINITIONS
CURLPP_TEMPLATE_EXPLICIT_INSTANTIATION

基于这三个宏的值

CURLPP_STATICLIB
BUILDING_CURLPP
CURLPP_SELF_CONTAINED

README.win32 文件中阅读它们并相应地定义以上三个宏。
如果您仍有问题,请告诉我们。

顺便说一句;今天我把当前版本的curlpp下载 curlpp-current.2009.05.21

关于c++ - 在 vs2008 中使用 CurlPP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/870110/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com