2

I'm building a C program with Visual Studio 2008, from the command line.

vcbuild /logcommands foo.vcproj

From the GUI, the build works fine. But from the command line, the build fails at the link stage, with these error mesages:

Linking...
   Creating library c:\foo\out\foo.lib and object c:\foo\out\foo.exp
Generating code
Finished generating code
LINK : fatal error LNK1104: cannot open file 'TEMPFILE'
Build log was saved at "file://c:\foo\out\BuildLog.htm"

What's this TEMPFILE, and how do I fix the build?

s.ouchene
  • 1,682
  • 13
  • 31
Gilles 'SO- stop being evil'
  • 104,111
  • 38
  • 209
  • 254

1 Answers1

7

The linker is trying to create a temporary file in the directory indicated by the TMP environment variable. Make sure that TMP is set and that it points to a directory where the linker can create files and that has enough disk space. E.g.,

set TMP=%HOMEDRIVE%%HOMEPATH%\Local Settings\Temp
vcbuild /logcommands foo.vcproj

(Found in the SCons FAQ of all places. My build scripts were messing up with TMP before calling vcbuild, for some unfathomable reason.)

Gilles 'SO- stop being evil'
  • 104,111
  • 38
  • 209
  • 254