I want to compile a CPP code using cmd.I tried to download dev c++ compiler and attached it to cmd using system settings but still, it was of no use due to certain libraries were not present. So is there any other compiler which can compile call code of CPP including libraries like unsortedmap.
- 1What library is "unsortedmap"? Is that an external one? If yes that is not a problem of the compiler - you need to tell it where it can find the necessary filesUnholySheep– UnholySheep2017-02-25 18:59:50 +00:00Commented Feb 25, 2017 at 18:59
- 1the best answer to your question is provided here: stackoverflow.com/q/10358745/7012517Shobhit– Shobhit2017-02-25 19:05:46 +00:00Commented Feb 25, 2017 at 19:05
- What is(are) the command(s) used to compile and link? What is "dev c++" compiler?lit– lit2017-02-25 19:49:09 +00:00Commented Feb 25, 2017 at 19:49
2 Answers
If you using Linux then you can compile it simply but writing the following line in the terminal:
g++ helloWorld.cpp -o helloWorld If you using Windows, you should consider to download Visual Studio and then you will be able to compile your program easily from within Visual Studio. and also you will be able to compile it using the command line:
- Open a developer command prompt
- cl /EHsc helloWorld.cpp
Download Visual Studio from Microsoft website:
Comments
I think you are missing the compiler. If you are running on Windows, download and install MinGW from here. During installation you can choose to install GNU Compiler Collection (GCC), including C++. After the installation you can compile the source file and run the executable using these commands.
> gcc -o HelloWorld.exe HelloWorld.c // Compile and link source file HelloWorld.c into executable HelloWorld.exe > HelloWorld // Execute HelloWorld.exe under CMD shell