某工程以前是有AboutBox的,后来被去掉了。近日在其中加入AboutBox,不想碰到如下错误:
--------------------Configuration: MSNLike_dll - Win32 Debug--------------------
Compiling...
MainFrm.cpp
e:/work/messangerinterface/msnlike_dll/msnlike_dll/aboutdlg.cpp(10) : error C2370: 'THIS_FILE' : redefinition; different storage class
E:/work/MessangerInterface/msnlike_dll/MSNLike_dll/MainFrm.cpp(12) : see declaration of 'THIS_FILE'
Error executing cl.exe.
MSNLike_dll.dll - 1 error(s), 0 warning(s)
网上仔细搜索,发现很少有解决方法,经仔细排查后发现原来是这个问题:
在Mainfrm.cpp中误加入下面语句所致
#include "AboutDlg.cpp"
--------------------Configuration: MSNLike_dll - Win32 Debug--------------------
Compiling...
MainFrm.cpp
e:/work/messangerinterface/msnlike_dll/msnlike_dll/aboutdlg.cpp(10) : error C2370: 'THIS_FILE' : redefinition; different storage class
E:/work/MessangerInterface/msnlike_dll/MSNLike_dll/MainFrm.cpp(12) : see declaration of 'THIS_FILE'
Error executing cl.exe.
MSNLike_dll.dll - 1 error(s), 0 warning(s)
网上仔细搜索,发现很少有解决方法,经仔细排查后发现原来是这个问题:
在Mainfrm.cpp中误加入下面语句所致
#include "AboutDlg.cpp"
本文解决了一个关于在项目中重新引入AboutBox时遇到的编译错误问题。错误源于头文件与源文件之间的不当包含,通过移除MainFrm.cpp中不必要的AboutDlg.cpp包含声明解决了该问题。
7001

被折叠的 条评论
为什么被折叠?



