不能编译C code用#include< SYS / times.h>在Cygwin中 [英] Cannot compile C code with #include <sys/times.h> in Cygwin

查看:428
本文介绍了不能编译C code用#include< SYS / times.h>在Cygwin中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图安装/编译库,如IGRAPH和SNAP在Windows 7中使用Cygwin(也试过MinGW的-MSYS),我遇到了一些问题。

I was trying to install/compile libraries such as igraph and SNAP in Windows 7 using Cygwin (and also tried MinGW-MSYS) and I ran into some problems.

我想我已经缩小问题通过 ./配置给出这个错误:

I think I have narrowed down the problem to this error given by ./configure:

checking sys/times.h usability... no
checking sys/times.h presence... no
checking for sys/times.h... no

在Cygwin的, /usr/include/sys/times.h 实际上做存在。我用Google搜索这个为MinGW和似乎SYS / times.h不适用于MinGW的,因为的POSIX / BSD与时俱进的功能是不是ANSI标准的一部分,在MINGW32运行时不存在

In Cygwin, /usr/include/sys/times.h actually do exists. I googled about this for MinGW and it seems that sys/times.h is not available for MinGW because "the POSIX/BSD "times" function is not part of the ANSI standard and does not exist under Mingw32 runtime".

作为一个实验,我尝试用gcc编译该C code Cygwin中:

As an experiment, I tried compiling this C code in Cygwin using gcc:

#include <stdio.h>
#include <sys/times.h>

int main (void) 
{

      return 0;
}

这不能编译,与误差 SYS / times.h没有这样的文件或目录。当我改变了包括这种情况甚至&LT; /usr/include/sys/times.h> &LT; usr / include目录/ SYS / times.h&GT; 。在Cygwin的命令promot /usr/include/sys/times.h 正常工作。

This does not compile, with the error sys/times.h no such file or directory. This happens even when I change the include to </usr/include/sys/times.h> or <usr/include/sys/times.h>. In the Cygwin command promot /usr/include/sys/times.h work correctly.

我如何得到SYS / times.h可用性和presence?是否有一个包或图书馆我可以安装?

How do I get sys/times.h usability and presence? Is there a package or library I can install?

推荐答案

您code与我的Cygwin没问题的编译。其实 / usr / include目录是默认的一个包括GCC的搜索路径,因此通常GCC应该可以找到 SYS / times.h

Your code compiles with no problem on my Cygwin. Actually /usr/include is one of the default include search paths for gcc, so normally gcc should be able to find sys/times.h.

也许你正在使用gcc,而不是Cygwin的GCC的MinGW的版本?尝试这GCC 来确保它的的/ usr / bin中/海湾合作委员会,也 GCC - -version ,以确保它不会像显示的mingw32-gcc.exe(GCC)XXX

Perhaps you are using MinGW version of gcc instead of Cygwin gcc? Try which gcc to make sure it's /usr/bin/gcc, and also gcc --version to make sure it does not display like mingw32-gcc.exe (GCC) x.x.x.

您也可以尝试编译详细输出你的C文件:

You can also try to compile your C file with verbose output:

gcc -v test.c

它显示了GCC如何查找包含文件。 / usr / include目录应的搜索路径之一,如果你使用Cygwin的海湾合作​​委员会。

It shows how gcc searches include files. /usr/include should be one of the search path list if you use Cygwin's gcc.

这篇关于不能编译C code用#include&LT; SYS / times.h&GT;在Cygwin中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆