错误重现:

1> vs2010创建 C++ win32 project, Application type: DLL.

2>为了在工程中使用 CString, 在 stdafx.h 中 Include <afx.h>.

3> 编译工程,编译结果如下:LNK1169 和 LNK2005

LNK1169 和 LNK2005

 

在网上找到一篇文章很详细的解释了这种现象的前因后果:

[随感]fatal error LNK1169: one or more multiply defined symbols found终极解决

下面是微软提供的一个解决方案:

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

 

下面我就总结列出在vs2010中解决这些错误的具体操作:

方案1> Project property -> Configuration Properties -> Linker/General/Force File Output

选择 “Multiply Defined Symbol Only (/FORCE:MULTIPLE)”。

 LNK1169 和 LNK2005

 

方案2> Project property -> Configuration Properties -> Linker/Command Line

将 /FORCE:MULTIPLE 加入到 Additional Options 里。

LNK1169 和 LNK2005

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-01
  • 2021-09-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-16
猜你喜欢
  • 2022-12-23
  • 2021-10-31
  • 2021-03-31
  • 2021-12-20
相关资源
相似解决方案