<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">When you call clang with “--analyze”, the driver is only going analyze your program with static analysis; it is not going to fully compile or link it. This explains why you do not see the linker error.<div class=""><br class=""></div><div class="">Cheers,</div><div class="">Anna.<br class=""><div><blockquote type="cite" class=""><div class="">On Dec 21, 2015, at 3:12 PM, via cfe-dev <Alexander G. Riccio> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">When I try to build a simple C program (attached), <font face="monospace, monospace" class="">clang-cl</font> warns about some - unrelated to this question - linking issue:<div class=""><br class=""></div><div class=""><div class=""><font face="monospace, monospace" class="">C:\Users\Alexander Riccio\Documents\basically_flawed_c_program>clang-cl basically_flawed_c_program.c</font></div><div class=""><font face="monospace, monospace" class="">basically_flawed_c_program-1f4f44.obj : error LNK2019: unresolved external symbol malloc referenced in function main</font></div><div class=""><font face="monospace, monospace" class="">basically_flawed_c_program-1f4f44.obj : error LNK2019: unresolved external symbol free referenced in function main</font></div><div class=""><font face="monospace, monospace" class="">LINK : error LNK2001: unresolved external symbol mainCRTStartup</font></div><div class=""><font face="monospace, monospace" class="">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'</font></div><div class=""><font face="monospace, monospace" class="">basically_flawed_c_program.exe : fatal error LNK1120: 3 unresolved externals</font></div><div class=""><font face="monospace, monospace" class="">clang-cl.exe: error: linker command failed with exit code 1120 (use -v to see invocation)</font></div><div class=""><br class=""></div></div><div class="">...but when I pass <font face="monospace, monospace" class="">--analyze</font> to <font face="monospace, monospace" class="">clang-cl</font>, it shuts up entirely:</div><div class=""><br class=""></div><div class=""><div class=""><font face="monospace, monospace" class="">C:\Users\Alexander Riccio\Documents\basically_flawed_c_program>clang-cl --analyze basically_flawed_c_program.c</font></div><div class=""><font face="monospace, monospace" class=""><br class=""></font></div><div class=""><font face="monospace, monospace" class="">C:\Users\Alexander Riccio\Documents\basically_flawed_c_program></font></div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">What's going on here??</div><div class=""><br class=""></div><div class="">I'm more interested in why the <font face="monospace, monospace" class="">--analyze</font> flag shuts <font face="monospace, monospace" class="">clang-cl</font> up, than I am the strange linker error; but bonus points if you know what's going on there too.</div><div class=""><br class=""></div><div class="">I'm also attaching the verbose invocations of the two commands.</div><div class=""><br clear="all" class=""><div class=""><div class="gmail_signature"><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div dir="ltr" class="">Sincerely,<br class="">Alexander Riccio<br class="">--<br class="">"Change the world or go home."<div class=""><a href="http://about.me/ariccio" target="_blank" class="">about.me/ariccio</a></div><div class=""><a href="http://about.me/ariccio" target="_blank" class=""><br class=""></a></div><div class="">If left to my own devices, I will build more.</div><div class="">⁂<br class=""></div></div></div></div></div></div></div>
</div></div>
<span id="cid:3D294DDF-42BC-445C-B453-813F4CA4C1C7"><clang-cl-verbose-invoke.txt></span><span id="cid:BC077DF3-9A76-4AFA-8468-C0C9F744FF87"><basically_flawed_c_program.c></span>_______________________________________________<br class="">cfe-dev mailing list<br class=""><a href="mailto:cfe-dev@lists.llvm.org" class="">cfe-dev@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev<br class=""></div></blockquote></div><br class=""></div></body></html>