CL not working

Hey, this is my first post - and it’s because I need help. I have no experience with C++, so this is all foreign to me.

My code is not compiling for the first part of the TripleX.cpp game. When I typed CL, it doesn’t work, and I get an error saying “cl is not recognized as an internal or external command, operable program or batch file”.

I pinned the command prompt from a previous lesson to my task bar, and opened that/typed “code” to open visual studio. I do not see any errors in the code. I successfully changed the default profile to cmd instead of powershell.

I’m going to include a screenshot of where I’m at, I have highlighted what I THINK the problem is, but I’m unsure how to fix it - if it’s even the problem. The command prompt from the previous version says visual basic 2019 community, so I’m wondering if it’s the wrong command prompt? If so, how do I fix that? Or if the problem is something else…I have no idea!

Thanks in advance, guys.

Visual Studio Community 2022/2019/etc. and Visual Studio Code are different products.

Visual Studio Community is a fully fledged integrated development environment (IDE). It comes with a compiler, debugging tools, an editor, etc.

Visual Studio Code on the other hand is just a text editor, it doesn’t have a compiler.

To be able to compile from the command line you need to run that command prompt (or the batch file that that prompt loads) in order to set up the environment to the compiler and standard libraries et al.

When you type “code” using that prompt it’s just opening VS Code with that environment loaded so you have access to “cl”, the compiler.


I’m not seeing anything particularly wrong with what you’re showing so could you try File > Close Folder, then Close > Window and then try again?

1 Like

I have closed/re opened the window multiple times using the X in the corner, but it never worked.

Closing the folder and the window from the File menu and starting over fixed it! Thank you! (not sure what the difference was, but getting stuck this early on really threw me for a loop)

Awesome, looks like I’m good to move on now. Thanks again!

I have been getting the same error I just tried what you said and it didn’t work

Could you please post your own screenshots of things?

I am facing the same error and I tried closing and reopening still it does not work, it says “‘cl’ is not recognized as an internal or external command,
operable program or batch file.”
I searched everywhere but I cannot find the answer to this.


I don’t even get the option like you do.
It also says this:

Pls give me more time and help me with this as I am a beginner and stuck at the very starting of the course.

Did you open VS Code through the developer command prompt?

If yes could you show what you get typing “cl” in the developer command prompt?

It says" ‘cl’ is not recognized as an internal or external command,
operable program or batch file." and I don’t know what the developer command prompt is. Though what I did was:

  1. Right clicked on triplex.cpp below the open editors.
  2. Clicked on Open in integrated terminal.
    Then this opened:

    Then I typed cl triplex.cpp and it says:

    So basically the problem is that the thing does not have a command called as cl and I cannot see the output.
    Is there any alternative to this?

It’s discussed in “Also Install VS Code” at around 7mins in and then it’s reminded you do this in “Your First Program” at around 4:50.

You should see this when opening it

Hey @DanM , I am also running into this issue. cl seems to be working in the Developer Command Prompt for VS 2022, but not in the vs code terminal. I have the C/C++ extension installed and enabled and I tried installing the latest version of PowerShell to see if that was the problem but I’m still getting the same error.

Did you use that command prompt to open VS Code? Did you try the steps in my initial reply to this thread?

Yes I used that command prompt. I think I got it working though after reading your first response.

I didn’t have a file open in the first place :man_facepalming: Although, in the “Also Install VS Code” video, Ben did not have a file open either, so I don’t know.

This looks better though, thanks for the help :grinning_face_with_smiling_eyes:

That looks to be working so could you describe your issue?

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

Privacy & Terms