因为要在动态库中添加一个HTTP下载的函数。所以使用了 CInternetSession类。引用了#include <afxinet.h>
在编译的时候报错,报错内容为 :
afxv_w32.h(14) : fatal error C1189: #error : WINDOWS.H already included,MFC apps must not #include <windows.h>
afxv_w32.h(14) : fatal error C1189: #error : WINDOWS.H already included,MFC apps must not #include <windows.h>然后,删除了所有的<windows.h> 之后编译,报错变成了
error LNK2005: _DllMain@12 已经在 dllmain.obj 中定义然后按照这个链接更改的
http://www.cnblogs.com/profession/p/5849440.html
在dllmain.cpp中添加了
#ifdef _X86_ extern "C" { int _afxForceUSRDLL; } #else extern "C" { int __afxForceUSRDLL; } #endif
并在 stdafx.h 中添加了
#include "afx.h"
#include <afxinet.h>
#include <windows.h> 完美编译通过。因为afx.h的引用 要求在 windows.h前面。

本文介绍了解决在使用CInternetSession类时遇到的编译错误问题,包括fatal error C1189和error LNK2005的具体解决步骤。
979

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



