马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
//talkback.c--一个能为你提供一切信息的对话程序。
#include <stdio.h>
#include <string>
#define DENSITY
int main(void)
{
float weight, volume;
int size, letters;
char name[40];
printf("HI What's your first name: \n");
scanf("%s", &name);
printf("%s, what's you weight in pounds: \n", name);
scanf("%f", &weight);
size = sizeof name;
letters = strlen(name);
volume = weight/DENSITY;
printf("well, %s, your volume is %2.2f cubic feet.\n", name, volume);
printf("Also, your first name has %d letter,\n", letters);
printf("and we have %d bytes to store it in.\n", size);
return (0);
}
代码如上,自觉没有任何问题,但是编译之后,出现了一个error:
c:\program files\microsoft visual studio\vc98\include\eh.h(32) : fatal error C1189: #error : "eh.h is only for C++!"
此时选中这个error之后,突然所有的源代码都变了。/***
*eh.h - User include file for exception handling.
*
* Copyright (c) 1993-1997, Microsoft Corporation. All rights reserved.
*
*Purpose:
* User include file for exception handling.
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_EH
#define _INC_EH
#if !defined(_WIN32) && !defined(_MAC)
#error ERROR: Only Mac or Win32 targets supported!
#endif
#ifdef _MSC_VER
// Currently, all MS C compilers for Win32 platforms default to 8 byte
// alignment.
#pragma pack(push,8)
#endif // _MSC_VER
#ifndef __cplusplus
#error "eh.h is only for C++!"
#endif
/* Define _CRTIMP */
#ifndef _CRTIMP
#ifdef _DLL
#define _CRTIMP __declspec(dllimport)
#else /* ndef _DLL */
#define _CRTIMP
#endif /* _DLL */
#endif /* _CRTIMP */
/* Define _CRTAPI1 (for compatibility with the NT SDK) */
#ifndef _CRTAPI1
#if _MSC_VER >= 800 && _M_IX86 >= 300
#define _CRTAPI1 __cdecl
#else
#define _CRTAPI1
#endif
#endif
typedef void (__cdecl *terminate_function)();
typedef void (__cdecl *unexpected_function)();
typedef void (__cdecl *terminate_handler)();
typedef void (__cdecl *unexpected_handler)();
#ifndef _MAC
struct _EXCEPTION_POINTERS;
typedef void (__cdecl *_se_translator_function)(unsigned int, struct _EXCEPTION_POINTERS*);
#endif
#if _MSC_VER >= 1200
_CRTIMP __declspec(noreturn) void __cdecl terminate(void);
_CRTIMP __declspec(noreturn) void __cdecl unexpected(void);
#else
_CRTIMP void __cdecl terminate(void);
_CRTIMP void __cdecl unexpected(void);
#endif
_CRTIMP terminate_function __cdecl set_terminate(terminate_function);
_CRTIMP unexpected_function __cdecl set_unexpected(unexpected_function);
#ifndef _MAC
_CRTIMP _se_translator_function __cdecl _set_se_translator(_se_translator_function);
#endif
#ifdef _MSC_VER
#pragma pack(pop)
#endif // _MSC_VER
#endif // _INC_EH
我都不认识了,这到底是怎么回事?求大神解答啊,上网百度了一下那个error,说是什么不是c++文件,但我确实是按照小甲鱼教的方式创建的啊,怎么突然就出现问题了呢,郁闷,跪求答案啊~~~~~~~~ |