C++多文件编译问题

1:

在查找预编译头使用时跳过解决

环境:VS2008

微软官方解释:
Visual C++Concepts: Building a C/C++ ProgramCompiler Warning (level 1) C4627Error Message
”: skipped when looking for precompiled header use
While searching for the location where a precompiled header is used, thecompiler encountered an #include directive for the include file. The compilerignores the #include directive, but issues warning C4627 if the precompiledheader does not already contain the include file.

解决方案:

1、去掉预编译头
项目->属性->配置属性->c/c++->预编译头->创建使用预编译头->不使用预编译头

2、将包含文件加到预编译头stdafx.h文件中

3、在每个.cpp中包含预编译头stdafx.h文件

 

2: 

#include  “包含文件名”  或 #include  <包含文件名>

两种格式的区别仅在于:

①使用双引号:系统首先到当前目录下查找被包含文件,如果没找到,再到系统指定的“包含文件目录”(由用户在配置环境时设置)去查找。

②使用尖括号:直接到系统指定的“包含文件目录”去查找。一般地说,使用双引号比较保险。

 多文件结构

大程序倾向于分成多个源文件,其理由为&

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值