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
and java
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
Sure, it's how most compilers got started. GCC is probably the most popular (comes with most flavors of *nix). Syntax is just
gcc my_source_code.cpp
, orgcc -o my_executable.exe my_source_code.cpp
. It gets more complicated, of course, when you have multiple source files (as in implementation; anything#include
d works automatically as long as GCC can find it).MinGW appears to be a version of GCC for Windows, if that's what you're using. I haven't tried it though.
Pretty sure most IDEs also include a command line interface. I know Visual Studio does, though I have never used it.