Getting undefined reference error while running a project in C++

SyntaxError :

I'm getting an error in C++ in VsCode. When I try to run this code(It's a very basic code):

#include <iostream>


int main()

{
    std::cout << "Hello World";
    return 0;
}

I'm getting this error:

undefined reference to 'WinMain@16' collect2.exe: error: ld returned 1 exit status

I know there are some solutions for this error in this forum but I still can't get it fixed because I'm new on C++ and I'm trying to learn it. Can someone help me?

melk :

The problem seems to be with the main-function. Try int wmain().

Check up on main-functions in c++ under windows here or here

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=382984&siteId=1