The getopt function is defined in the unistd.h header file. This header file is only available on posix compatible systems. For example, on Windows it's not available when building without mingw.