It depends on what compiler you're using.
For example, if you are using Visual C++ .NET 2010 Express, run Visual C++ 2010 Express Command Prompt from the start menu, and you can simply compile and run the code.
> cl /EHsc mycode.cpp
> mycode.exe
or from the regular command line, you can run vcvars32.bat
first to set up the environment. Alternatively search for setvcvars.cmd
(part of a FLOSS project) and use that to even locate the installed VS and have it call vcvars32.bat
for you.
Please check your compiler's manual for command lines.
manpreet
Best Answer
2 years ago
I know that everyone uses an IDE nowadays, but I just find it simpler to write my code in notepad++, compile it using a command prompt command, and run it from there too. At least that works for Java and Python. I've tried to get my head around how to do that with C++, and haven't been able to find anything good. Is there any compiler (like Java's JDK) that I can stick into my path and use the C++ equivalent of
javac
andjava
to run and compile my code from CMD?Note: please don't post answers and comments about how IDEs are better - I know they are. I'm just used to doing it the old way :D