C语言,编译没问题,但运行出错
#include<stdio.h>
int main()
{
int age;
printf("age代表年龄:");
scanf("%d",&age);
printf("\nage=%d\n",age);
return 0;
}
编译没出错 运行 就有一个错误 怎么回事啊
[解决办法]
运行了,没有任何问题,楼主看看是不是输入不是整数。
[解决办法]
MinGW环境下编译、运行通过,没有错误?错误提示呢?
[解决办法]
未发现错误哦。
[解决办法]
难道是里面有中文输入。
[解决办法]
在文件末尾留一行空格再试试
[解决办法]
[解决办法]
http://msdn.microsoft.com/en-us/library/4exw7xyc(v=vs.71).aspx
Fatal Error C1004
unexpected end of file found
The compiler reached the end of a source file without resolving a construct. The code may be missing one of the following elements:
A closing brace
A closing parenthesis
A closing comment marker (*/)
A semicolon
Other possible causes
The default disk drive has insufficient space for temporary files, which require about twice as much space as the source file.
An #if directive that evaluates to false lacks a closing #endif directive.
A source file does not end with a carriage return and line feed.
The following sample generates C1004:
// C1004.cpp
#if TEST
// uncomment the next line
// #endif
int main() {
}
// C1004
[解决办法]
单步调试,什么问题都能解决
[解决办法]
我是按照这个方法来修改,修改后就恢复了
打开vc界面 点击VC“TOOLS(工具)”—>“Option(选择)”
—>“Directories(目录)”重新设置“Excutable Fils、Include Files、
Library Files、Source Files”的路径。很多情况可能就一个盘符的不同
(例如你的VC装在C,但是这些路径全部在D),改过来就OK了。
如果你是按照初始路径安装vc6.0的,路径应为:
executatble files:
C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin
C:\Program Files\Microsoft Visual Studio\VC98\BIN
C:\Program Files\Microsoft Visual Studio\Common\TOOLS
C:\Program Files\Microsoft Visual Studio\Common\TOOLS\WINNT
include files:
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE
C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE
C:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE
library files:
C:\Program Files\Microsoft Visual Studio\VC98\LIB
C:\Program Files\Microsoft Visual Studio\VC98\MFC\LIB
source files:
C:\Program Files\Microsoft Visual Studio\VC98\MFC\SRC
C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE
C:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE
C:\Program Files\Microsoft Visual Studio\VC98\CRT\SRC
如果你装在其他盘里,则仿照其路径变通就行(我就是装在D盘)。
关键是microsoft visual studio\ 后面的东西要相同。
本人深受其害,重装多次不管用,上面中文部分为高手借鉴,
下面路径为本人深思所得,终于解决。与君分享。
vc中出现“没有找到mspdb60.dll文件”时:
将C:\Program Files\Microsoft Visual Studio 6\Common\MSDev98\Bin下的mspdb60.dll
文件拷贝到C:\Program Files\Microsoft Visual Studio 6\VC98\Bin目录下即可
[解决办法]
控制台程序不是win32
[解决办法]
怎么解决的?
[解决办法]
偶遇到类似问题都是用
“每次用/*...*/注释掉不同部分再重新编译,直到定位到具体语法出错的位置。”
的方法解决的。
[解决办法]
VS的问题,使用了预处理编译的那个啥啥啥,而且未包含“stdafx.h”(好像是这么写的)
[解决办法]
代码没问题。是不是工程建错了
[解决办法]
我觉得这个是没错的,但是你弄了个返回0;输出以后,你又返回一个假,才出错吧
[解决办法]