[Solved] ‘cl’ is not recognized as an internal or external command

Below is the error message when I run “scons” to compiler in windows7:

'cl' is not recognized as an internal or external command,
operable program or batch file.
scons: *** [outwindows-x86-MD-unicode-vs2008-relobj-staticsrcfeaturesetsada                                      ptersim-historyAddToChatRoomHistoryVisitor.obj] Error 1
scons: building terminated because of errors.

I have added path to environment variables already, but still met this problem.

Below is the PATH info of environment variables:

1.0;C:Program FilesCREDANTShield v7.1;C:Program Files (x86)QuickTimeQTSystem;C:Program Fil
esMicrosoft SQL Server110ToolsBinn;C:Program FilesTortoiseSVNbin;C:Python27;C:cygwin64bin
;C:Python27scons-2.3.1;c:Program Files (x86)Microsoft SQL Server100ToolsBinn;c:Program File
sMicrosoft SQL Server100ToolsBinn;c:Program FilesMicrosoft SQL Server100DTSBinn;C:Progra
m Files (x86)Microsoft Visual Studio 10.0VCbin;C:Python27Scripts;C:Program Files (x86)Microso
ft Visual Studio 10.0VClib;C:Program Files (x86)Microsoft Visual Studio 10.0VCinclude
Solution #1:

The location of the cl.exe executable is not in the system PATH environment variable.

In other words the cmd.exe command line processor has been asked to run the cl.exe executable but it can’t find it. It is either not in the PATH or not installed.

I have added path to environment variables already, but still met this problem.

To test this open a command prompt and type in:

cl.exe -?

Respondent: jussij
Solution #2:

SCons has logic to find the location of the visual studio install and set the path and other environment variables needed by visual studio tools by inspecting the registry and also default install locations.

If it’s failing for you then you should produce a debug log and pastebin it somewhere for us to see.



and then runs scons from the same shell. The log will be in


You might also try the latest version of SCons 2.4.1 as I note there were some fixes for MSVS/MSVC in later versions. But in theory 2.3.1 should find Visual Studio 2010..

Respondent: bdbaddog
Solution #3:

Simply do window search for cl.exe, and add that path to PATH variable, save it. Close the existing open command and reopen it it before executing cl.exe. Hope this will work.

Respondent: Pankaj
Solution #4:

I was having the same issue and found a better way to fix it from @bdbaddog answer to get the debug log from set SCONS_MSCOMMON_DEBUG=%TEMP%SCONS_MSVS_DEBUG.log SCons seem to find the cl.exe

00073ms:MSCommon/vc.py:_check_cl_exists_in_vc_dir#588:checking for cl.exe at C:Program Files (x86)Microsoft Visual Studio2019CommunityVCToolsMSVC14.26.28801binHostx64x64cl.exe: 
00073ms:MSCommon/vc.py:_check_cl_exists_in_vc_dir#590:found cl.exe!: 

And scons env env['ENV']['PATH'] has the cl.exe path but it doesn’t use it, So I just updated the session path using scons path like below and it worked

os.environ['PATH'] = env['ENV']['PATH']
Respondent: thakee nathees
The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Leave a Reply

Your email address will not be published.