When I open a .cpp file separate of any project in MSVC, the debugging tools are greyed out and intellisense doesn’t seem to be parsing the text. Is there a way to make it so when I open an individual .cpp file, I can compile it straight away without having to copy paste the code into a new project?
Share
You can’t debug it, because there is no program. One file does not make a program. Project “makes” a program.
This won’t work, because to compile even one file you might need specific compiler settings (include directories), which are specified within project.
However, you can use “Visual Studio command prompt”, locate your file and run
cl filename.cpp(filename.cpp is your file) command which will attempt to compile/link single file without specifying extra settings. You won’t get assistance from ide in this case, but you might be able to compile it (assuming the file contains trivial program that doesn’t need extra settings) and read any errors you get from command prompt.