cygwin下strptime函数找不到的解决方法

一段代码使用到了 strptime 这个函数,之前在cygwin下gcc 4.9.3 可以编译通过,重装cygwin后,新的gcc 6.3.0 编译不通过,strptime是不可识别的,
在cygwin的include目录下执行

 find . -name "*.h" |xargs grep strptime

发现定义在 /usr/include/time.h 中,需要先定义 __XSI_VISIBLE 才会有,查看了一下__XSI_VISBLE定义出现的地方
在Make文件中添加 -D_XOPEN_SOURCE=700 重新编译,问题解决

Popularity: 11% [?]

Random Posts

Comments

Comments are closed.