<div>  Hi all, I am new to Clang/LLVM and this list, so apologies if this is the wrong channel (also:  now accepting redirection to the proper channel!)</div><div> </div><div>I enlisted in the LLVM and Clang branches and followed the web page instructions on getting them building (which worked without a hitch, kudos).  I then tried compiling a dead simple hello world program and ran into some linker errors I can't quite figure out.  I reduced the necessary code to cause some of the errors down to this:</div>

<div> </div><div>#include <stdio.h><br>#include <iostream></div><div>int main(int argc, char **argv)<br>{<br>    return 0;<br>}</div><div> </div><div>Once I #include iostream, things go bad.  Specifically I see this</div>

<div> </div><div>HelloWorld-778227.o : error LNK2019: unresolved external symbol __ZdlPv referenced in function __ZNSt14error_categoryD0Ev<br>HelloWorld-778227.o : error LNK2001: unresolved external symbol ___cxa_pure_virtual<br>

HelloWorld-778227.o : error LNK2001: unresolved external symbol __ZTVN10__cxxabiv117__class_type_infoE</div><div> </div><div>I understand the linker can't find these things, I guess I just don't understand where they are supposed to be coming from.  I invoke clang with specific directions to link with both libcmt.lib and libcpmt.lib which should include all the CRT/STL stuff I need (I think).  Specifically I invoked this (and have included the output):</div>
<div> </div><div>c:\build>clang HelloWorld.cpp -o HelloWorld.exe -Xlinker "c:\Program Files\Microsoft Visual Studio 10.0\VC\lib\LIBCPMT.LIB" -v</div><div> </div><div>clang version 3.0 (trunk 140598)</div><div>
<br>Target: i686-pc-win32<br>Thread model: posix</div><div> </div><div>"c:/build/bin/debug/clang.exe" -cc1 -triple i686-pc-win32 -emit-obj -mrelax-all -disable-free -main-file-name HelloWorld.cpp <br>-mrelocation-model static -mdisable-fp-elim -masm-verbose -mconstructor-aliases -target-cpu pentium4 -momit-leaf-frame-pointer <br>
-v -resource-dir c:/build/bin/debug\..\lib\clang\3.0 -fmodule-cache -path C:\Users\rmolden\AppData\Local\Temp\clang-module-cache <br>-fdeprecated-macro -ferror-limit 19 -fmessage-length 80 -fms-extensions -fms-compatibility -fmsc-version=1300 -fdelayed-template-parsing <br>
-fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o C:/Users/rmolden/AppData/Local/Temp/HelloWorld-778227.o <br>-x c++ HelloWorld.cpp</div><div> </div><div>clang -cc1 version 3.0 based upon llvm 3.0 hosted on i686-pc-win32</div>
<div> </div><div>ignoring nonexistent directory "/usr/local/include"<br>ignoring nonexistent directory "/usr/include"<br>#include "..." search starts here:<br>#include <...> search starts here:<br>
 C:\Program Files\Microsoft Visual Studio 10.0\VC\include<br> C:\Program Files\Microsoft SDKs\Windows\v7.1\\include<br>End of search list.</div><div> </div><div>"C:/Program Files/Microsoft Visual Studio 10.0/VC/BIN/link.exe" -out:HelloWorld.exe -defaultlib:libcmt -nologo <br>
C:/Users/rmolden/AppData/Local/Temp/HelloWorld-778227.o c:\Program Files\Microsoft Visual Studio 10.0\VC\lib\LIBCPMT.LIB</div><div> </div><div>clang: error: linker command failed with exit code 1120 (use -v to see invocation)</div>
<div> </div><div>HelloWorld-778227.o : error LNK2019: unresolved external symbol __ZdlPv referenced in function __ZNSt14error_categoryD0Ev<br>HelloWorld-778227.o : error LNK2001: unresolved external symbol ___cxa_pure_virtual<br>
HelloWorld-778227.o : error LNK2001: unresolved external symbol __ZTVN10__cxxabiv117__class_type_infoE</div><div>HelloWorld.exe : fatal error LNK1120: 3 unresolved externals<br></div><div>I searched Bugzilla and the internets, and apart from a blog posting from someone else complaining about iostreams with clang on Windows I wasn't able to find anything helpful.</div>
<div> </div><div>At this point I am assuming the answer is some variation of 'you're doing it wrong', but I can't figure what 'it' is, or how one goes about 'doing it right', so any help/pointers/hints would be much appreciated!</div>
<div> </div><div>Ryan</div>