I installed MSVC as directed in Microsoft's documentation for Visual Studio Code, but I cannot compile anything unless I launch VS code from the dev command line after also CD-ing to my code directory.
I was expecting to be able to open VS code, start a project, write some code and then hit the compile button. instead I get a "cl.exe build and debug is only usable when VS Code is run from the Developer Command Prompt for VS." error. why can't I just run code? this seems super clunky if every time I have to open my IDE, I have to do it from a special command line instead of just opening the IDE. do I need to add some things to my path to get Visual Studio Code to just pick up the MSVC compiler (I'd prefer to use VS code as I'm used to it from the other time's I've started learning to code, so I'm comfortable with it & would rather not switch to normal visual studio or anything else)
There are two main options when using MSVC.
"cpp": "cd $dir && cl /EHsc *.cpp /Fo..\\obj\\ /Fe..\\out\\Program.exe && ..\\out\\Program"Remember, your compiler must be in your path if you use this method and debugging is more annoying. Projects can be set up faster though.
Something really important to mention is that your projects get compiled for the 32x Version. This will only change when running the 64x dev command prompt. Run
>clto see the version you will compile to.This is what my default CMakeLists.txt file looks like:
A long time ago I also made this piece of python code. It will launch VS Code with the 64x dev shell, as long as your projects are located in C:\dev.