A LNK2005 error occurs when the CRT library and MFC libraries are linked in the wrong order in Visual C++

来源:互联网 发布:类似易企秀的软件免费 编辑:程序博客网 时间:2024/06/07 02:13

http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q148652 写的挺正确的。

 

下面的实际解决方法之一。

 

在编译一个opensource代码的时候,发现其在 stdafx.h文件的最前面包含了其他代码,导致如下问题出现

#pragma once

#include "../../../DSUtil/SharedInclude.h"

 

#define VC_EXTRALEAN// Exclude rarely-used stuff from Windows headers

 

#define ResStr(id) CString(MAKEINTRESOURCE(id))

 

#include <afxdisp.h>

#include <afxole.h>

#include <streams.h>

#include <dvdmedia.h>

#include <mpconfig.h>

#ifndef _WIN64

#include <qt/qt.h>

#endif

 

#include "../../../DSUtil/DSUtil.h"

 

修改方式为:将#include "../../../DSUtil/SharedInclude.h" 放到后面,这样lib库的加载顺序会变为先加载mfc库。 OK

 

原创粉丝点击