0

Just started c++, shouldn't be anything wrong with the code.

#include <iostream>

int main() 
{

    std::cout << "Hello World!\n";
    return 0;
}

This is the error message I get:

C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o): in function `main':
C:/_/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crt0_c.c:18: undefined reference to `WinMain'
collect2.exe: error: ld returned 1 exit status

I don't know what that means, I tried doing the tutorial again, but the same error comes up.

General Grievance
  • 4,555
  • 31
  • 31
  • 45

1 Answers1

0

Go to your mingw folder with command line. In bin folder there is g++ executable. Go there and type next command:

g++ "path to your c++ source file" -o "path for executable output"

If mingw compilers where added to your PATH variable, you can use g++ in any folder