Building a program giving me error messages


TODO: Reformat for MediaWiki formatting.


stdio.h: no such file or directory

(or another standard header)

This may be occur if you install GCC but not the w32api and mingw-runtime packages. The MinGW installer (e.g. MinGW-3.1.0-1.exe) includes all the basic packages you need: GCC, binutils, w32api, mingw-runtime and mingw32-make. See


gcc: no input files

This error may be caused by installing MinGW and MSYS in the same path. This is not permitted, so you will need to remove them and install again in separate directories. However, one may be a subdirectory of another, e.g. MSYS in c:\msys\1.0 and MinGW in c:\msys\1.0\mingw. This may not be an issue if you're using versions of MSYS later than 1.0.10.


undefined reference to xxx

If you see an undefined reference to some function (xxx), when trying to link an application, this can sometimes be caused by an issue with libraries. You may not have included a needed library. Order is important when specifying libraries to the linker on the command line. Changing the order of the libraries may sometimes fix this error as well.
For instance, you may see an error such as the one below:

Link error: undefined reference to `htonl@4'

In this case, you may be missing the libwsock32 library and need to specify it in the link with -lwsock32.

This wiki is not a forum for discussion of usage issues. Please use the list instead. We do not allow creation of comments by anonymous or untrusted users, on any page.
Site Status

Site maintenance performed successfully, site online Dec 13th 12:00 AM Eastern.