I'm trying to set up the Hg-Git Mercurial Extension, which recommends using the C compiler for Microsoft Visual C++ 2008. I've installed Visual C++ 2008, but I can't figure out where the C compiler is located so that I can add it to my path.
3 Answers
Windows 7 / Vista:
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\Bin\cl.exe
Windows XP:
C:\Program Files\Microsoft Visual Studio 9.0\VC\Bin\cl.exe

- 320
- 3
- 3
-
If anyone ends up here while trying to set up a MatLab xPC Target, just use `C:\Program Files (x86)\Microsoft Visual Studio 9.0` for the compiler path. – RubberDuck Jul 15 '16 at 20:34
-
Not quite. `C:\Program Files (x86)` only exists in *64-bit* versions of Windows. For *32-bit* Windows it's the same `C:\Program Files` in XP / 7 / Vista / 10. – dxiv Jul 31 '16 at 05:16
Currently accepted answer is incorrect in case when Program Files
directory has been moved away (i.e. is now on another drive, H:\Program Files
or H:\Program Files (x86)
), which means it is no longer available in default path (C
drive).
Visual Studio 2008
Windows XP 32-bit (x86):
%ProgramFiles%\Microsoft Visual Studio 9.0\VC\bin\cl.exe
Windows Vista 32-bit and later Windows operating systems (x86):
%ProgramFiles%\Microsoft Visual Studio 9.0\VC\bin\cl.exe
Windows XP 64-bit (x64):
%ProgramFiles(x86)%\Microsoft Visual Studio 9.0\VC\bin\cl.exe
Windows Vista 64-bit and later Windows operating systems (x64):
%ProgramFiles(x86)%\Microsoft Visual Studio 9.0\VC\bin\cl.exe

- 1
- 1

- 856
- 2
- 7
- 15
-
What if you installed a different ProgramFiles and not the primary one no matter where %ProgramFiles(x86)% points to. I think the accepted answer is not bad, it only doesn't handle an edge case, also yours could be inccorent in edge cases. – Anton Krug Jun 05 '18 at 08:49
-
-
Can you please edit your comment for Windows 10? I can't see %ProgramFiles(x86)% Environment variable in Windows 10. – bsguru Oct 19 '18 at 07:16
Related Answer for those who may be using Visual Studio 2012 and 2013 "ultimate" on a Windows 8.1 machine and are trying to locate the version of your current C++ compiler; you should be able to navigate to:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin>
and open a command prompt as administrator.
Then within the administrative command prompt, you can enter the following command:
"cl -option"
and hit return. It will look like this just before you press return:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin>cl -option
The version of your C++ compiler should then show up within the command prompt something like this:
Microsoft (R) C/C++ Optimizing Compiler Version 18.00.30723 for x86 Copyright (C)
Microsoft Corporation. All rights reserved.

- 21
- 3