Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WinInet undefined identifier

Im pretty new to c++ programming so bear with me . I'm trying to create a ftp client for educational purposes, Did some research and decided to give Wininet a try and came across some online tutorials :

Take this as an example:

#include <windows.h>
#include <wininet.h>

Note that there is no error checking or what so ever , this is just sample code.

int main(){

HINTERNET hInternet = InternetOpen(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);

HINTERNET hFtpSession = InternetConnect(hInternet, "server", INTERNET_DEFAULT_FTP_PORT, "user", "pass", INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0);  

...


InternetCloseHandle(hInternet); 

}

while writing this my ide(Vs2017) tells me "identifier internetOpenW is undefined". And the same with "InternetConnect". I've been looking for a solution all over, with no succes ! I would appreciate any help , as i have nowhere else to turn to !

excuse my bad english !

like image 695
Yoni Blauer Avatar asked Oct 25 '25 20:10

Yoni Blauer


1 Answers

MSDN

Add "wininet.lib" here: Project Properties -> Linker -> Input -> Additional Dependencies

Don't forget to specify "wininet.lib" for both build configurations (Debug and Release).

like image 189
KonstantinL Avatar answered Oct 28 '25 10:10

KonstantinL