<div>I need clang for my experimentations in Windows. I tried to compile and link with clang on Windows. However, I'm getting a bunch of linking errors. For example:</div>
<div> </div>
<div>error LNK2005: _InterlockedIncrement64 already defined in cc-000000.o<br>error LNK2005: _InterlockedDecrement64 already defined in cc-000000.o<br>error LNK2005: _InterlockedExchange64 already defined in cc-000000.o<br>
error LNK2005: _InterlockedExchangeAdd64 already defined in cc-000000.o</div>
<div> </div>
<div> </div>
<div>I was able to see the reason. When a source file includes "Windows.h" and does use Win32 APIs, then clang emits some Win32 API definitions in the object files. I've confirmed by looking bitcode.</div>
<div> </div>
<div> </div>
<div>======== </div>
<div>define i64 @InterlockedAnd64(i64* %Destination, i64 %Value) nounwind {<br>entry:<br>  %Destination.addr = alloca i64*, align 4<br>  %Value.addr = alloca i64, align 8<br>  %Old = alloca i64, align 8<br>  store i64* %Destination, i64** %Destination.addr, align 4<br>
  store i64 %Value, i64* %Value.addr, align 8<br>  br label %do.body</div>
<div>...<br>=======</div>
<div> </div>
<div>These definitions exist in every object files, resulting in duplication linking errors.</div>
<div> </div>
<div> </div>
<div>I do believe there would be a very simple workaround for it. I'm compiling clang/llvm sources directly. Is there any quick  solution for that?</div>
<div> </div>
<div>Thank you!</div>
<div> </div>