The VS code's terminal could not recognize the “cl” command

I am stuck at the beginning of the course. I installed Visual studio community 2019, UnrealEngine and Visual Studio Code as described on the video. But my VS code cmd’s terminal could not recognize the “cl” command.
On my VS code terminal. I have this error message:

'cl' is not recognized as an internal or external command,
operable program or batch file.

On my PowerShell (for VS 2019) terminal, I have the following error message:

Enter-VsDevShell : 6375ac70
At line:1 char:132
+ ... ools\Microsoft.VisualStudio.DevShell.dll"; Enter-VsDevShell 6375ac70}
+                                                ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Enter-VsDevShell], ItemNotFoundException
    + FullyQualifiedErrorId : VsInstallationNotFound,Microsoft.VisualStudio.DevShell.Commands.EnterVsDevShellCommand

Can you double check that you started VS Code from the ‘Developer Command Prompt’ and not from an icon or a non-dev prompt?

Yes, I tried starting VS Code from both the Developer PowerShell for VS 2019 and Command Prompt terminals, but I still had the same issue.

I re-installed the software and I started the VS code from the Developer Command Prompt. The cl command seems work but I still had error message when compiling a file with the following simple command lines

#include <iostream>

int main() {
    std::cout << "Hello World!";
    return 0;
}

This is the error message

hello_word.cpp
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\ostream(746): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
hello_word.cpp(4): note: see reference to function template instantiation 'std::basic_ostream<char,std::char_traits<char>> &std::operator <<<std::char_traits<char>>(std::basic_ostream<char,std::char_traits<char>> &,const char *)' being compiled
Microsoft (R) Incremental Linker Version 14.28.29336.0    
Copyright (C) Microsoft Corporation.  All rights reserved.
/out:hello_word.exe
hello_word.obj

I get that same message, but it creates a working executable file.

I think it’s just an informational message, and not an error. Lesson 21 provides a way to remove these messages.

More help please!

Before running the code, I had the cmd terminal.
step1

But when I ran it, it turned into ‘code’, and I had nothing as a result.
step2

Thanks

It looks like you’re running the “.cpp” file. When the ‘cl’ command runs, it compiles the .cpp file and creates an executable from it. The executable is a brand new file with a “.exe” extension.

Here is the output from my terminal when I compile (cl TripleX.cpp) and then run (TripleX.exe) the program:
image

It is solved, thanks a lot.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.