I want to check my internet connection. This is my code:
#include <iostream>
#include <windows.h>
#include <Wininet.h>
#pragma comment(lib,"Wininet.lib")
using namespace std;
int main()
{
if (InternetCheckConnection("http:\\www.google.com", FLAG_ICC_FORCE_CONNECTION, 0))
{
cout << "You are connected to the Internet" << endl;
}
else
{
cout << "You are not connected to the Internet" << endl;
}
}
But it shows the following error:
C:\Users\icl\AppData\Local\Temp\ccGjaicH.o n.cpp:(.text+0x22): undefined reference to `__imp_InternetCheckConnectionA'
C:\Users\icl\Desktop\New folder\collect2.exe [Error] ld returned 1 exit status
How to solve it?