Search code examples
ceclipsecygwin

Eclipse CDT errors when building files


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.


Solution

  • 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.