Skip to content

billti/LNK2005

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Linker error demo

This code demonstrates the linker error:

 error LNK2005: "public: int __cdecl C::Called(void)" (?Called@C@@QEAAHXZ) already defined in obj1.obj

This is caused by a DLL exporting the same symbol that another .obj file contains due to an inline header definition.

See obj1.cpp and replace the call with the non-inline version to resolve the error.

clang-cl can avoid this problem with the the new /Zc:dllexportInlines- flag. (See http://blog.llvm.org/2018/11/30-faster-windows-builds-with-clang-cl_14.html).

Open a Visual Studio x64 Developer Command prompt and run build.cmd to repro.

About

Linker error demo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published