Reputation: 41
I'm pretty new to this stuff, and solutions from similar threads aren't working for me, so I'm asking again with my specific problem
I'm trying to compile a C++ program with a main() function on windows OS. So I used
g++ -std=c++11 -o hw2 *.cpp
but I get this error when trying to compile
bin/ld.exe: c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-
w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o): in function `m
ain':
C:\temp\gcc\build-mingw-w64\mingw-w64-crt/../../src/mingw-w64-crt/crt/crt0_c.c:1
8: undefined reference to `WinMain'
collect2.exe: error: ld returned 1 exit status
make: *** [all] Error 1
neither -mwindows or -mconsole flags solved this
Upvotes: 1
Views: 750