编译时undefined reference to `WinMain'的问题
(2015-11-17 18:19:12)
今天修改了makefile文件,以前可以编译通过的文件报如下链接错误。但明明还是在编译.cpp文件生成.o文件的阶段报的错。最后原因是g++在编译时忘记加-c参数。
g++ -Wall -fmessage-length=0
-I"I:\LocalData\IGRTWS/mpatrol/include" -g -DDEBUG LogForCPP.cpp -o
debug/LogForCPP.o
D:/msys64/mingw64/x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o):
In function `main':
C:/repo/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