尝试在ADS 1.2中编写代码,但始终收到错误C2304E:预计会出现命令,但找到了'int'/'unsigned'。我个人找不到代码有什么问题,它可以在其他编译器上正常运行。有人有同样的问题吗?这是代码:
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#define N 288
#define M 352
#define filename "akiyo_cif_0_yuv420.yuv"
unsigned char current_y[N][M];
unsigned char temp;
void read() {
FILE *frame_c;
if((frame_c=fopen(filename,"rb"))==NULL) {
printf("current frame doesn't exist\n");
exit(-1);
}
for(i=0;i<N;i++) {
for(j=0;j<M;j++) {
temp=fgetc(frame_c);
if (temp = fgetc(frame_c) == EOF) {
/* error OR end-of-file */
;
}
else
current_y[i][j] = (char)temp;
}
}
fclose(frame_c);
}
int main() {
read();
unsigned char *Img =& current_y[0][0]; //Error C2304E: command expected but found 'unsigned'
int result = CLAHE (Img,352,288,0,227,2,2,256,3); //Error C2304E: command expected but found 'int'
printf("%d",result);
}
最佳答案
Arm在其网站上说:
但是我找不到C标准的哪个版本。较新的版本允许在块的任何位置声明变量,但是较旧的C版本要求在块的顶部声明变量。从我们的评论尝试中,似乎Arm支持此较旧的C版本。因此,请将main更改为:
int main() {
unsigned char *Img =& current_y[0][0];
int result = CLAHE (Img,352,288,0,227,2,2,256,3);
read(); // executable statements only after declaring variables.
printf("%d",result);
}
关于c - ADS v1.2错误C2304E : <command> expected but found 'int' ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/53469941/