[英]C language: what does this error mean?
TYPE *a = calloc(nelem, sizeof(TYPE));
It says "unable to resolve identifier TYPE". 它说“无法解析标识符TYPE”。 What does this mean? 这是什么意思?
Here is the code our professor gave us. 这是我们教授给我们的代码。 We need to implement heapsort (did that in Java, and I know how it works, but I am a C virgin.) 我们需要实现heapsort(在Java中做到了,我知道它是如何工作的,但是我是C处女。)
When compiling using the code below: 使用以下代码进行编译时:
gcc -std=c99 -DRAND -DPRNT -DTYPE={float, double} -D{BUBB, HEAP, INSR, MERG} *.c
You have to pick either float
or double
: 您必须选择float
或double
:
gcc -std=c99 -DRAND -DPRNT -DTYPE=float -D{BUBB, HEAP, INSR, MERG} *.c
gcc -std=c99 -DRAND -DPRNT -DTYPE=double -D{BUBB, HEAP, INSR, MERG} *.c
Similarly for BUBB
, HEAP
, INSR
, MERG
. 对于BUBB
, HEAP
, INSR
, MERG
同样MERG
。
Add the following define to the begining of the file: 将以下定义添加到文件的开头:
#define TYPE int
or 要么
#define TYPE float
Take care that TYPE
replacement should be a numerical type 请注意, TYPE
替换应为数字类型
compiler is not able to resolve TYPE, it must be typedef...you have to include headerfile where it is defined or else define it before use. 编译器无法解析TYPE,它必须是typedef ...您必须在定义它的地方包含头文件,否则必须在使用前定义它。 eg typedef int TYPE; 例如:typedef int TYPE;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.