-1

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.

Sunil Kumar
  • 17
  • 1
  • 5
  • 1
    What 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 files – UnholySheep Feb 25 '17 at 18:59
  • 1
    the best answer to your question is provided here: http://stackoverflow.com/q/10358745/7012517 – Shobhit Feb 25 '17 at 19:05
  • What is(are) the command(s) used to compile and link? What is "dev c++" compiler? – lit Feb 25 '17 at 19:49

2 Answers2

2

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:

  1. Open a developer command prompt
  2. cl /EHsc helloWorld.cpp

Download Visual Studio from Microsoft website:

https://www.visualstudio.com/downloads/

NinjaYo.
  • 103
  • 6
0

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