VC常见预编译问题

1、Fatal error C1010: Unexpected end of file while looking for  precompile header, Did you forget to add "#include "stdafx.h" to you shource?

     Fatel  error :cannot  open  include  file :"stdafx.h": no find  file or diectory;

   分析:如上提示,stdafx 是预编译头文件,我们可以不使用微软提供的 预编译头文件;

   方法: 将解决方案 Properties -- configuration Properties ---C /C++-- 的选项Create/Use precompiled Header,选择 Not using PreCompiled Headers;

 

 

2、Warning: “#include “common.h”Skipped  when  looking for Precompiled Header  use  add directive  to 'stdafx.h' or rebuild  precompiled  header

     error :  C2065: "CP_UTF8":undeclared  identifier

     error : C25451: cannot  delete  objects  that  are  not pointer  

   分析:预编译头文件有#include 的顺序 :

    #include “stdafx.h”

    #include“afx.h”

   #include“common.h”

 

3、   C4996    'inet_addr': Use inet_pton() or InetPton() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings    CCollection    C:\Users\Think\Documents\Visual Studio 2015\Projects\Progr\CCollection\cWinTcpClient.cpp

解决方案,项目 =》属性 =》c/c++  =》预处理器=》点击预处理器定义,编辑,加入_WINSOCK_DEPRECATED_NO_WARNINGS,即可。

4、'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details

解决方案,项目 =》属性 =》c/c++  =》预处理器=》点击预处理器定义,编辑,加入_CRT_SECURE_NO_WARNINGS,即可。

5、#error: "No Target Architecture"

解决:

根本原因:

是因为单独包含了一些windows.h已经包含了的头文件如"fileapi.h","WinUser.h",但是却没有包含windows.h 或者先包含了如"fileapi.h","WinUser.h",后包含windows.h,顺序不对 

先说解决方案:

在代码中 加入include  “windows.h” 即可,或者调整顺序,把winows.h放在前面
--------------------- 
作者:Bird鸟人 
来源:CSDN 
原文:https://blog.csdn.net/wcc27857285/article/details/85197877 
版权声明:本文为博主原创文章,转载请附上博文链接!

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值