Visual Studio 2010中编译C code [英] Visual Studio 2010 Compiling C code

查看:120
本文介绍了Visual Studio 2010中编译C code的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下的code片段。这是在Visual Studio 2010中的C文件,如果我尝试用线来编译:整数你好= 10;注释掉它会编译就好了。如果我评论说,行不会编译。我缺少的东西或者我应该不使用Visual Studio 2010来编译C code下。如果这是一个Visual Studio的问题,任何人都可以推荐一个易于使用的IDE /编译器,我可以对C

感谢您

 为int * X =(INT *)释放calloc(1,sizeof的(INT));* X = 5;// INT你好= 10;的printf(的Hello World%I!,* X);的getchar();


解决方案

您不能声明(如 INT你好= 10; )后,非申报(如 * X = 5; )的C89,C99不同或C ++

MSVC 2010仍然不支持C99。

I have the following code snippet. This is a c file in visual studio 2010. If i try to compile this with the line: int hello = 10; commented out it will compile just fine. If I comment that line in it will not compile. Am I missing something or should I not be using Visual Studio 2010 to compile C code. If this is a Visual Studio problem can anyone recommend a easy to use IDE / Compiler that I can for C.

Thank You

int* x = (int*) calloc(1, sizeof(int));

*x = 5;

//int hello = 10;

printf("Hello World!  %i", *x);

getchar();

解决方案

You can't have declarations (like int hello = 10;) after non-declarations (like *x = 5;) in C89, unlike C99 or C++.

MSVC 2010 still does not support C99.

这篇关于Visual Studio 2010中编译C code的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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