1.背景
任务参考代码:VC++删除老版本软件的桌面快捷方式(附源码)
参考:
VC++删除老版本软件的桌面快捷方式(附源码)_dvlinker的博客-CSDN博客_c++删除桌面同名快捷图标
问题描述
1.编译器错误问题的解决( error C2065: ‘CFileFind’),引入头文件afx.h,但还是没找到CFileFind
2.第二个问题:#error WINDOWS.H already included. ?MFC apps must not #include <windows.h>
原因分析
1.预编译标头不是第一个指令,则会忽略预编译头文件之前的所有预处理器指令。(例如?#include、#define?或?#pragma)
参考:编译器错误 C2065 | Microsoft Learn
2.重复包含<windows.h>
解决方案:
1.#include <afx.h>不要放在#include "stdafx.h"前面,放在#include "stdafx.h"里边
2."stdafx.h"文件添加:#include <afx.h>//20221122,放在#include <souistd.h>前面.
因为afxwin.h文件中包含了afx.h,afx.h文件中包含了afxver_.h,afxver_.h中包含了afxv_w32.h,而afxv_w32.h中包含了windows.h;
"stdafx.h"包含 <souistd.h>,后者包含windows.h