When I try to build a simple C program (attached), clang-cl warns about some - unrelated to this question - linking issue:
C:\Users\Alexander Riccio\Documents\basically_flawed_c_program>clang-cl basically_flawed_c_program.c
basically_flawed_c_program-1f4f44.obj : error LNK2019: unresolved external symbol malloc referenced in function main
basically_flawed_c_program-1f4f44.obj : error LNK2019: unresolved external symbol free referenced in function main
LINK : error LNK2001: unresolved external symbol mainCRTStartup
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\libcmt.lib : warning LNK4272: library machine type ‘X86’ conflicts with target machine type ‘x64’
basically_flawed_c_program.exe : fatal error LNK1120: 3 unresolved externals
clang-cl.exe: error: linker command failed with exit code 1120 (use -v to see invocation)
…but when I pass --analyze to clang-cl, it shuts up entirely:
C:\Users\Alexander Riccio\Documents\basically_flawed_c_program>clang-cl --analyze basically_flawed_c_program.c
C:\Users\Alexander Riccio\Documents\basically_flawed_c_program>
What’s going on here??
I’m more interested in why the --analyze flag shuts clang-cl up, than I am the strange linker error; but bonus points if you know what’s going on there too.
I’m also attaching the verbose invocations of the two commands.
clang-cl-verbose-invoke.txt (6.3 KB)
basically_flawed_c_program.c (208 Bytes)