错误C2143:语法错误:缺少“;”前“型” [英] error C2143: syntax error : missing ';' before 'type'

查看:311
本文介绍了错误C2143:语法错误:缺少“;”前“型”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来编程C本..请告诉我,什么是错的这个节目,为什么我收到此错误:错误C2143:语法错误:缺少;前型 ...

 的extern无效FUNC();INT主(INT ARGC,字符** argv的){
    FUNC();
    INT I = 1;
    对于(; I< = 5;我++){
        注册INT数= 7;
        的printf(数量为%d \\ n,编号++);
    }
    残培();
}


解决方案

我没有在8年以上使用的视觉,但似乎视觉有限的C编译器的支持不允许混code和变量。是误差对申报行 INT I = 1; ??尝试移动它调用上面 FUNC();

另外,我会使用的extern无效FUNC(无效);

I am new to programming C.. please tell me what is wrong with this program, and why I am getting this error: error C2143: syntax error : missing ';' before 'type'....

extern void func();

int main(int argc, char ** argv){
    func();
    int i=1;
    for(;i<=5; i++) {
        register int number = 7;
        printf("number is %d\n", number++);
    }
    getch();
}

解决方案

I haven't used visual in at least 8 years, but it seems that Visual's limited C compiler support does not allow mixed code and variables. Is the line of the error on the declaration for int i=1; ?? Try moving it above the call to func();

Also, I would use extern void func(void);

这篇关于错误C2143:语法错误:缺少“;”前“型”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆