Link error in Clang Visual studio 2008

Hi,

I have compiled llvm on Windows Visual Studio 2008. The project builds successfully. However, on executing clang to compile a simple hello world C program, I get following link error. (I had to add C:\Documents and Settings\suri\llvm\bin\Debug into window path to invoke clang ).

Any help would be appreciated.

Surinder:

C:\Documents and Settings\suri\llvm\bin\Debug>clang -v foo.c
clang version 2.9 (trunk 120997)
Target: i686-pc-win32
Thread model: posix
“C:/Documents and Settings/suri/llvm/bin/Debug/clang.exe” -cc1 -triple i686-pc-
win32 -emit-obj -mrelax-all -disable-free -main-file-name foo.c -mrelocation-mod
el static -mdisable-fp-elim -masm-verbose -mconstructor-aliases -v -resource-dir
C:/Documents and Settings/suri/llvm/bin/Debug/…/lib/clang/2.9 -ferror-limit 19
-fmessage-length 80 -fms-extensions -fmsc-version=1300 -fgnu-runtime -fdiagnost
ics-show-option -fcolor-diagnostics -o C:/DOCUME~1/suri/LOCALS~1/Temp/cc-000000.
o -x c foo.c
clang -cc1 version 2.9 based upon llvm 2.9svn-r120997 hosted on i686-pc-win32
ignoring nonexistent directory “/usr/local/include”
ignoring nonexistent directory “/usr/include”
#include “…” search starts here:
#include <…> search starts here:
C:/Documents and Settings/suri/llvm/bin/Debug/…/lib/clang/2.9/include
C:\Program Files\Microsoft Visual Studio 9.0\VC\include
C:\Program Files\Microsoft SDKs\Windows\v6.0A\include
End of search list.
“link.exe” -out:a.out -defaultlib:libcmt -nologo C:/DOCUME~1/suri/LOCALS~1/Temp
/cc-000000.o
clang: error: unable to execute command: program not executable
clang: error: linker command failed due to signal 1 (use -v to see invocation)

clang is trying to call link.exe from the msvc toolchain. link.exe is
not in your PATH environment.
Please note that using clang on Windows with MSVC is experimental.

What is the best-supported way to use clang on Windows? MinGW? What about for working with all 64-bit binaries?

You must run clang from the "Visual Studio Command Line", or first run
"Microsoft Visual Studio ${VERSION}\VC\bin\vcvars32.bat". This sets up
all of the environment variables that are used to lookup stuff.

- Michael Spencer

AFAIK 64-bit on windows is not working and if it does at all it is
more experimental than using clang with msvc.