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!
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?
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)
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.
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:
Right clicked on triplex.cpp below the open editors.
Clicked on Open in integrated terminal.
Then this opened:
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.