Compiler doesn't work?

I didn’t realize I was having this issue until later in the course, but the compiling process for Windows isn’t working for me. When I type “cl” and hit enter I have this error if I’m using the command prompt shell

C:\FastSaves\Visual Studio Code\TripleX>cl
‘cl’ is not recognized as an internal or external command,
operable program or batch file.

and this one if I’m using PowerShell

cl : The term ‘cl’ is not recognized as the name of a cmdlet, function, script
file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.
At line:1 char:1

  • cl
  • ~~
    • CategoryInfo : ObjectNotFound: (cl:String) , CommandNotFoundE
      xception
    • FullyQualifiedErrorId : CommandNotFoundException

is it possible I installed it wrong or something?

You meant to use CMD not PowerShell

yeah I know, I was just showing it’s not working either way

thanks for the awesome information.

Did you open VS Code via the developer command prompt?

yes, I have been. Maybe I should give opening it with the shortcut a shot?

Could you show what you get in the developer command prompt typing “cl”?

Ok! It’s fixed! Thank you! when I went to go check and do what you asked I noticed that the path was wrong, and I realized that the developer prompt I was using must have been from before I uninstalled and reinstalled it somewhere else, and it must not update when this happens. So I unpinned it and relocated it and it worked! I did wind up coming across another issue, but solved that after I realized that I had “return 0;” before the hello world line. There’s this extra thing that’s coming up when it’s compiling, but seeing how the code runs in the end I’m choosing to ignore it and hope it doesn’t come back later to bite me. Probably not the best idea. I’ll go ahead and put it here in case someone knows what is and whether I can ignore it. Thanks everyone for your help!

note: see reference to function template instantiation ‘std::basic_ostream<char,std::char_traits> &std::operator <<<std::char_traits>(std::basic_ostream<char,std::char_traits> &,const char *)’ being compiled

1 Like

The C++ Standard Library uses exceptions and due to historical reasons MSVC needs to be told to use the C++ exception handling model (by default it uses “structured exception handling” aka SEH).

So to get standard behaviour you will need to compile with /EHsc (case sensitive)
e.g.

cl triplex.cpp /EHsc

Docs: /EH (Exception handling model) | Microsoft Docs

1 Like

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

Privacy & Terms