4

I build Clang/LLVM using VS12 Win64

clang version 3.7.0 (http://llvm.org/git/clang 9a5a6f0e149ba035168641ca6dc4e3b3e
5aa29b5) (http://llvm.org/git/llvm 1de72bda4e6114393ddc8bad2c13d8abee3d374a)
Target: x86_64-pc-windows-msvc
Thread model: posix

When compiling this:

#include <iostream>

using namespace std;

int main() {
    cout << "Hello World!" << endl;
}

I receive this error:

libcmt.lib(typinfo.obj) : fatal error LNK1112: module machine type 'X86' conflic
ts with target machine type 'x64'
clang++.exe: error: linker command failed with exit code 1112 (use -v to see inv
ocation)

LNK1112 seems to be about using wrong machine target types but I don't know how this applies to Clang

1 Answer 1

1

Just stumbled over this question and thought this might help:

As Clang (at least as of version 10.0.0) under Windows by default uses the linker provided by MS Visual Studio to produce the executable, the path variable to your link.exe most probably points to the 32-bit version and thus the linker tries to link the 32-bit version of the library to your 64-bit object file in order to produce a 64-bit executable file, resulting in the LNK1112 linker error.

There are two ways to solve this issue: either use a 32-bit version of Clang or a 64-bit version of link.exe.

1
  • I don’t use Clang in Windows anymore, but I’ll keep this in mind if it comes up again. I don’t think I can mark your answer as solved because I can’t verify it right now.
    – Brady Dean
    Jan 11, 2020 at 18:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.