0

When trying to build a simple Hello world program in C and Elcipse, I get the following errors:

make: *** [C.exe] Error 1 C C/C++ Problem

recipe for target 'C.exe' failed makefile /C/Debug line 29 C/C++ Problem

undefined reference to `WinMain' C line 39, external location: C:\cygwin64\usr\src\debug\cygwin-1.7.33-1\winsup\cygwin\lib\libcmain.c C/C++ Problem

I'm using Cygwin. How can I fix this? I am selected the Cygwin toolchain, and I have the PATH set to C:\cygwin64\bin.

CaffeineToCode
  • 830
  • 3
  • 13
  • 25
  • winmain is a library entry, not an executable, so it matters not as to the contents of the PATH environment string. Rather, setup the project to look in the correct directory for the correct header file. BTW: you did $include the header file that contains the prototype for winmain? – user3629249 Dec 15 '14 at 02:44

1 Answers1

0

The undefined reference means you are missing a library. To set this up right click the project, select Properties -> C/C++ General -> Paths and Symbols -> Libraries and Libraries Paths. Add the appropriate library and build again.

Also look here - gcc-undefined-reference-to and here.

Community
  • 1
  • 1
Doncho Gunchev
  • 2,159
  • 15
  • 21