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
版权声明:本文为博主原创文章,转载请附上博文链接!