肺结节能吃消炎药吗:C++中的问题 "eh.h is only for C++!" 求救!

来源:百度文库 编辑:杭州交通信息网 时间:2024/05/01 13:34:08
这是源程序,应该没问题!
#include <iostream>
using namespace std;
class Teacher
{
public:
Teacher(char *input_name)//有参数的构造函数
{
name=new char[10];
//name=input_name;//这样赋值是错误的
strcpy(name,input_name);
}
void show();

protected:
char *name;

};

void Teacher::show()
{
cout<<name<<endl;
}

void main()
{
//Teacher a;//这里是错误的,因为没有无参数的构造函数
Teacher a("test");
a.show();
cin.get();
}

编译后出现的结果
--------------------Configuration: 1 - Win32 Debug--------------------
Compiling...
1.c
c:\program files\microsoft visual studio\vc98\include\eh.h(32) : fatal error C1189: #error : "eh.h is only for C++!"
Error executing cl.exe.

1.obj - 1 error(s), 0 warning(s)

昏了...难道不能在VC6.0里编译吗??????

把1.c改为1.cpp