蓝森林首页 | 返回主页 | 本站地图 | 站内搜索 | 联系信箱 |
 您目前的位置:首页 > 自由软件 > 技术交流 > 应用编程


    

蓝森林 http://www.lslnet.com 2006年6月6日 10:18


"stdafx.h" 为何打不开,跪求高手相助

#include <iostream>
#include "stdafx.h"
#include <string.h>

class numbers
{
int i;
char str[100];
public:
numbers(int j,char *ptr)
{
i=j;
strcpy(str,ptr);
}
void operator **();

void display();
{
cout<<str<<"is "<<i<<"yours old\n";
}
};
void numbers::operator **()
{
i++;
}

int main()
{
numbers dem(12,"&Iacute;&otilde;±&oslash;");
dem.display();
**dem;
dem.display();
return 0;
}
竟然出现这样的出错信息
e:\liguo\qw.cpp(2) : fatal error C1083: Cannot open include file: 'stdafx.h': No such file or directory
Error executing cl.exe.
出现上述原因我不知所措,希望您能指点迷津,小弟不胜感激!

stdafx是vc中的预编译头文件,如果找不到的话也许是没有提供,可以在源代码中去掉这个include

回复 2楼 converse 的帖子

多谢,可是我试过把include给删掉,error反而更多。拜托,你再想想问题出在哪。

#include ""只是表示从本目录开始查找,然后再查找系统默认路径,
可能是你的这些路径下根本没有此文件。
那么找到文件的位置,然后写全路径试试——#include "全路径/....h"



Copyright © 1999-2000 LSLNET.COM. All rights reserved. 蓝森林网站 版权所有。 E-mail : webmaster@lslnet.com