So, recently I installed Visual Studio 2008 and would like to use cl.exe as compiler. Rules still same with VC6, accessing command line tools like cl.exe require some steps to be performed. Here’s 2 problem I found so far:
1. Problem with mspdb80.dll
When we try to execute cl.exe, pop-up window will show which said “This application has failed to start because mspdb80.dll was not found. Re-installing the application may fix this problem”.
Solution for this case is easy, search for mspdb80.dll on your machine and put that .dll into your VC\bin directory. It was located at “C:\Program Files\Common Files\Microsoft Shared\VSA\9.0\VsaEnv” in my system.
2. Environtment variable hasn’t been set correctly
If you’re using IDE provided by visual studio, everything already set-up properly. But when you’re using command line, you should set it up manually. Visual studio already give batch script which can be used to set-up environtment variable correctly. Environment here: lib, include, etc.
Without set it up first, below error will occurred:
C:\Documents and Settings\Cyberheb\My Documents>cl hoho.c Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.21022.08 for 80x86 Copyright (C) Microsoft Corporation. All rights reserved. hoho.c hoho.c(1) : fatal error C1034: stdio.h: no include path set
To fix, run vcvars32.bat under VC\bin directory, which will run batch script “E:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\vsvars32.bat” in my system. After that, simple compilation should going through:
C:\Documents and Settings\Cyberheb\My Documents>cl hoho.c Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.21022.08 for 80x86 Copyright (C) Microsoft Corporation. All rights reserved. hoho.c Microsoft (R) Incremental Linker Version 9.00.21022.08 Copyright (C) Microsoft Corporation. All rights reserved. /out:hoho.exe hoho.obj
Of course using IDE is much easier, but still…in some case command line is preferable than IDE. Especially when you’re trying to compile some wild spl0it :). Complete cl.exe options can be found here, I’ll post about various options next time.