gpt4 book ai didi

c++ - 尝试urldownloadtofile函数时出错

转载 作者:行者123 更新时间:2023-12-02 10:52:27 26 4
gpt4 key购买 nike

使用urldownloadtofile时出现错误,错误是:未定义对“URLDownloadToFileA”的引用

#include <iostream>
#include <Windows.h>
#include <string>
#pragma comment(lib, "urlmon.lib")

using namespace std;
int main()
{
string dwnld_URL = "http://www.412312myfuptoload.com/downloadpage/Honeygain.exe";
string savepath = "C:\\Users\\Ester\\Appdata\\Roaming\\Honeygain.exe";
URLDownloadToFile(NULL, dwnld_URL.c_str(), savepath.c_str(), 0, NULL);

return 0;
}

最佳答案

#pragma comment(lib, "urlmon.lib")与MSVC(或兼容)编译器一起使用。
从错误和您的previous问题来看,您似乎正在使用MinGW(ld链接器),但它不支持它。
因此,您应该与-lurlmon选项链接。

关于c++ - 尝试urldownloadtofile函数时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64092621/

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