[英]Wininet giving linker errors I'm using devc++
#include <iostream>
#include <windows.h>
#include <wininet.h>
#pragma comment(lib, "wininet")
#include <pshpack4.h>
#include <poppack.h>
using namespace std;
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
HINTERNET hInternet;
HINTERNET hFtpSession;
hInternet = InternetOpen(NULL,INTERNET_OPEN_TYPE_DIRECT,NULL,NULL,0);
hFtpSession = InternetConnect(hInternet, "ftp.drivehq.com",INTERNET_DEFAULT_FTP_PORT, "usr" ,"pass", INTERNET_SERVICE_FTP, 0, 0);
FtpPutFile(hFtpSession, "log.txt", "mylog.txt", FTP_TRANSFER_TYPE_BINARY, 0);
InternetCloseHandle(hFtpSession);
InternetCloseHandle(hInternet);
return 0;
}
[Linker error] undefined reference to `InternetOpenA@20' [Linker error] undefined reference to `InternetConnectA@32' [Linker error] undefined reference to `FtpPutFileA@20' [Linker error] undefined reference to `InternetCloseHandle@4' [Linker error] undefined reference to `InternetCloseHandle@4' ld returned 1 exit status C:\Users\Wade\Desktop\test\command builder\Makefile.win [Build Error] [command.exe] Error 1
我的代碼有什么問題,它總是給我鏈接器錯誤?
我的第一個C ++程序有很多這樣的錯誤。 與WinINet庫鏈接時出現問題。 如果您使用的是MinGW,請在其他命令參數中添加“ -lwininet”(不帶引號),並且應將其固定。 如果您使用VC ++,我不知道該怎么辦。 另外,請確保WinINet庫的位置在鏈接器的搜索路徑中。 另一個注意事項:MinGW的WinInet中不存在INTERNET_PER_CONN_ *變量,還有一些其他變量,我還沒有找到解決該問題的解決方案。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.