0
点赞
收藏
分享

微信扫一扫

gcc_vc


******************************************************

WIN7 VC:

*******************************************************

在.c后缀syntax error : missing ';' before 'type' --- [代码在.cpp文件中编译成功]

一种如下,变量定义在函数之后


#include<stdio.h>
#include<string.h>

int main()
{
char a[100];
memset(&a, 0, 100);
char b;

return 0;
}

我写的宏pragma的时候遇到的也是这个错误,根据​​链接​​最后一个代码可知:​​javascript:void(0)​​ 。

***********************************************************

Linux

***********************************************************

下gcc 中 ,错误:在 C99 模式之外使用 ‘for’ 循环初始化声明---  [代码在.cpp用g++可以编译成功]

#include<stdio.h>

//filename:for.c
//compile:gcc for.c
//error:错误:在 C99 模式之外使用 ‘for’ 循环初始化声明
int main()
{
for(int i=0;i<10;i++);
return 0;
}

gcc可编译成功的.c

#include<stdio.h>
//filename:for.c
//compile:gcc for.c
//successful
int main()
{
int i;
for( i=0;i<10;i++);
return 0;
}

 

举报

相关推荐

0 条评论