首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

头文件放置还有顺序有关问题吗

2012-04-05 
头文件放置还有顺序问题吗?在VC6.0建一个控制台工程,当这样是:#includemath.h#includestdafx.h #inclu

头文件放置还有顺序问题吗?
在VC6.0建一个控制台工程,
当这样是:
#include   <math.h>
#include   "stdafx.h "
#include   <iostream>
using   namespace   std;

出现一个错误:
error   C2065:   'sqrt '   :   undeclared   identifier

改为
#include   "stdafx.h "
#include   <iostream>
using   namespace   std;
#include   <math.h>

      重新编译后,一个错误也没有了。头文件放置还有顺序问题吗?

[解决办法]
#include "stdafx.h "要写在前面
[解决办法]
#include "stdafx.h " 使用预编译头文件需要把它放到程序最前面,否则它前面的内容会被忽略。

热点排行