主题:C++编译出错
各位大侠帮帮忙,编译这个程序时出现下面的错误!!!请各位帮我看看为什么出错了???
#include <iostream>
#include<fstream>
using namespace std;
ifstream in;
static int x=0;
static char ch[256];
static int getchar(void){
in.open("d:\\shortpath.cpp");
in.getline(ch,256);//每次只取一行,最多可以取256个字符
return ch[x++];
}
void main(){
char cha;
cha=getchar();
cout<<cha<<endl;
char w;
w=getchar();
cout<<w<<endl;
char e;
e=getchar();
cout<<e;}
1>d:\my documents\visual studio 2008\projects\111\111\222.cpp(7) : error C2491: 'getchar' : definition of dllimport function not allowed
#include <iostream>
#include<fstream>
using namespace std;
ifstream in;
static int x=0;
static char ch[256];
static int getchar(void){
in.open("d:\\shortpath.cpp");
in.getline(ch,256);//每次只取一行,最多可以取256个字符
return ch[x++];
}
void main(){
char cha;
cha=getchar();
cout<<cha<<endl;
char w;
w=getchar();
cout<<w<<endl;
char e;
e=getchar();
cout<<e;}
1>d:\my documents\visual studio 2008\projects\111\111\222.cpp(7) : error C2491: 'getchar' : definition of dllimport function not allowed