0
Error "undefined reference to 'WinMain'" id returned 1 exit status
In the constant variable printing part of c++ tutorial here, i copied everything in the example as it is checked numerous times but it keeps giving me UNDEFINED REFERENCE TO "WINMAIN" error. I created the header files properly and used it before for previous lessons but in this case when i try to use the header file like the example says, compiler gives me the above mentioned error. I am using Dev C++ ide. It may be some kind of coding issue or compiler issue. So if anyone find any answer, please reply.. thanks in advance
7 Respostas
+ 2
Winmain as I recall is used for Windows GUI application, examples here are console based codes only. Did you *probably* created a GUI application project by accident?
+ 2
The error means that the compiler try to find WinMain() but it didn't.
Either you didn't declare int main()
Or your project type is something other than Console. (Normally Win32GUI)
+ 1
Did you declare int main()?
+ 1
Oh so i habe to declare console project type.. as i recall while creating the project for the header file i declared it as an empty project. So it will be ok if i do the examples on console project right?
+ 1
itâs irrelevant here, but just so you know itâs âldâ that returned with exit code 1, not âidâ. ld is the gnu linker. and as you mentioned you created a gui project instead of a console one.
0
Yeah.. is there a problem? the example also declared int main()