c - ADS v1.2 错误 C2304E : <command> expected but found 'int'

标签 c compiler-errors arm

尝试在 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/

相关文章:

java - 为什么我的程序在使用foreach循环迭代ArrayList时显示这种类型的错误?

android - GCC 6 移位溢出错误,

linux - 如何修复在 RasPi 上运行 "Segmentation fault"命令时出现的 "dotnet"错误?

c - 更新队列并从队列中删除所需的内容

将对象从一个 json 数组复制到另一个

qt - 链接器错误LNK2001和LNK2019

c++ - 在Xcode和Visual Studio之间移动的问题

Connector/C 的 MySQL 字符编码

c++ - 使用开源Clamav引擎

c - arm-none-eabi-gcc C 指针