getopt.h: Compiling Linux C-Code in Windows

后端 未结 9 1903
梦谈多话
梦谈多话 2020-11-30 02:20

I am trying to get a set of nine *.c files (and nine related *.h files) to compile under Windows.

The code was originally designed in Linux to take command line argu

9条回答
  •  爱一瞬间的悲伤
    2020-11-30 03:15

    You are correct. getopt() is POSIX, not Windows, you would generally have to re-write all command-line argument parsing code.

    Fortunately, there is a project, Xgetopt, that is meant for Windows/MFC classes.

    http://www.codeproject.com/Articles/1940/XGetopt-A-Unix-compatible-getopt-for-MFC-and-Win32

    If you can get this working in your project, it should save you a fair bit of coding and prevent you from having to rework all parsing.

    Additionally, it comes with a nice GUI-enabled demo app that you should find helpful.

    Good luck!

提交回复
热议问题