您的位置:首页 > 编程语言 > C语言/C++

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

2011-02-23 09:11 686 查看
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐