I need to be able to compile a piece of code at work that was originally written for Unix based systems. I am using cygwin and the GNU gcc. Every time I try to run the make command, the program seems to compile as it should but when it gets to timing.h it produces this error:
我需要能够在工作中编译一段最初为基于Unix的系统编写的代码。我正在使用cygwin和GNU gcc。每次我尝试运行make命令时,程序似乎都按照它应该的方式进行编译,但是当它需要计时的时候。它产生了这个错误:
Compiling: timing.c timing.h... timing.c:1:0: warning: -fPIC ignored for target
(all code is position independent)
#include "timing.h"
^
In file included from timing.c:1:0:
timing.h:5:26: fatal error: sys/resource.h: No such file or directory
#include <sys/resource.h>
^
compilation terminated.
timing.h:1:0: warning: -fPIC ignored for target (all code is position independent)
#include <sys/time.h>
^
timing.h:5:26: fatal error: sys/resource.h: No such file or directory
#include <sys/resource.h>
^
compilation terminated.
make: *** [timing.o] Error 1
From what I have read, usually the cause of this kind of error is caused by an incorrect path. The contents of timing.h are as follows:
根据我所读到的,这种错误通常是由错误的路径引起的。时间的内容。h如下:
#include <sys/time.h>
#include <sys/types.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/resource.h>
void timing(double* wcTime, double* cpuTime);
The thing that baffles me is that even-though the files are in the same directory I only get the error as it tries to include the last file. I have made sure that the $C_INCLUDE_PATH points to where the files are.
令我困惑的是,即使文件在同一个目录中,当它试图包含最后一个文件时,我也只能得到错误。我已经确保$C_INCLUDE_PATH指向文件所在的位置。
$ echo $C_INCLUDE_PATH
/usr/include/
Any help would be awesome. This has stumped me for a few days now. I am running gcc version 4.9.0.
任何帮助都会很棒。这让我困惑了好几天。我正在运行gcc 4.9.0版本。
1 个解决方案
#1
0
Your cygwin /usr/include/sys
directory appears to be missing the resource.h
file.
您的cygwin /usr/include/sys目录似乎丢失了资源。h文件。
I just checked my cygwin installation and resource.h
and time.h
are both present in /usr/include
我刚刚检查了cygwin安装和资源。h和时间。h都在/usr/include中
You might be missing a cygwin package, or your cygwin installation may need to be updated.
您可能缺少cygwin包,或者需要更新cygwin安装。
#1
0
Your cygwin /usr/include/sys
directory appears to be missing the resource.h
file.
您的cygwin /usr/include/sys目录似乎丢失了资源。h文件。
I just checked my cygwin installation and resource.h
and time.h
are both present in /usr/include
我刚刚检查了cygwin安装和资源。h和时间。h都在/usr/include中
You might be missing a cygwin package, or your cygwin installation may need to be updated.
您可能缺少cygwin包,或者需要更新cygwin安装。