尝试在 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 在其网站上表示:
The ARM Compiler toolchain ... supports full ISO standard C and C++.
但是我找不到具体的 C 标准版本。较新的版本允许在 block 中的任何位置声明变量,但旧版本的 C 要求在 block 的顶部声明变量。从我们在评论中的尝试来看,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/