Gigi
Gigi

Reputation: 1

Error message when trying to compile mingw

Hi does anyone know what to do. When I try to compile my programs I get this message and I dont know how to fix it. I've tried uninstall everything and updating my IDE (VS code and Qt creator) but still doesnt work

C:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o):crt0_c.c:(.text.startup+0x2e): undefined reference to `WinMain'

collect2.exe: error: ld returned 1 exit status

Upvotes: 0

Views: 812

Answers (1)

Sean Michael McGhee
Sean Michael McGhee

Reputation: 11

This may or may not help but there are 3 possibilities I can think of:

1 - you are trying to execute the code in the editor of VS Code without saving it.

2 - you are trying (inadvertently?) to create a Windows gui app which requires WinMain.

3 - you have int main wrapped in a namespace declaration.

My problem was #3 (I removed the namespace and fully qualified the objects inside main) and I saw a video on #1. Not sure about #2.

Hope some of this helps.

Sean

Upvotes: 0

Related Questions