I am new to visual studio code & I am trying to configure it with C++. I have installed MinGW compiler and It is successfully installed (I tested it with a command g++ --version on a command prompt). I have also added the environment path in the system settings. I have also installed Code runner extension in VS code, but when I try to compile my code, I get this error:
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../libmingw32.a(main.o):(.text.startup+0xb0): undefined reference to `WinMain@16'
collect2.exe: error: ld returned 1 exit status
I searched about this problem for a while but I am still unable to fix this issue. I have learned while searching that I am getting this error because I am not using the main function but I am just trying to compile simple hello world code.
#include<iostream>
using namespace std;
int main()
{
cout<<"Hello world";
}