我有两个课程,包括课程和课程.它们都在同一个包和同一目录中.
Offering.java:
package assignment02;
public class Offering implements Comparable<Offering> {
private Course course;
private int CRN;
private int semester;
public Offering(Course course, int CRN, int semester) {
this.course = course;
this.CRN = CRN;
this.semester = semester;
}
public int getNumCredits() {
return course.getNumCredits;
}
public int getCRN() {
return CRN;
}
public int getSemester() {
return semester;
}
public int compareTo(Offering other) {
if(other == null) return - 1;
return semester - other.semester;
}
}
Run Code Online (Sandbox Code Playgroud)
Course.java:
package assignment02;
public class …
Run Code Online (Sandbox Code Playgroud) cygwin可以使用gettimeofday()吗?我收到错误:
lab8.cpp: In function ‘int main()’:
lab8.cpp:62:30: error: ‘gettimeofday’ was not declared in this scope
gettimeofday(&start, NULL);
^
makefile:14: recipe for target 'lab8.o' failed
make: *** [lab8.o] Error 1
Run Code Online (Sandbox Code Playgroud)
我肯定包括在内<sys/time.h>
.是否有我必须安装的软件包,或者它是否在Windows上无法运行?
编辑:这是一个产生相同错误的简单测试:
#include <sys/time.h>
int main() {
struct timeval start;
gettimeofday(&start, NULL);
}
Run Code Online (Sandbox Code Playgroud)
有错误:
$ g++ -c -Wall -g -std=c++11 test.cpp -o test.o
test.cpp: In function ‘int main()’:
test.cpp:6:30: error: ‘gettimeofday’ was not declared in this scope
gettimeofday(&start, NULL);
Run Code Online (Sandbox Code Playgroud)