MingW not taking input, configured with Atom


So, I installed Atom on Windows, along with the gpp package (https://atom.io/packages/gpp-compiler) and the MinGW compiler. Lately, however, it is behaving weirdly, and when I press the F5 key to execute some of my programs, the command line simply is showing Press any key to continue… whereas it should be taking input. On the other hand, when I run my code on https://repl.it, it is working fine, and doing exactly what is expected. It isn’t a complicated software project or anything, it is just rudimentary dynamic programming for solving a competitive programming question, so my code doesn’t rely on anything except the STL.

My filename is FlippingGame.cpp (mentioning this because it gave me another error when I had a space in between the name).

Has anyone faced this problem before? I tried searching online, haven’t got anything like this. It keeps skipping the input, and runs to the end of the program.

Also, I have my path name set correctly, to C:\MinGW\bin, and normal HelloWorld seems to run fine on it.

Edit: Running fine on default MinGW that comes with Codeblocks as well, wonder what could be causing it to crash on my custom MinGW and atom specifically?


Just so you all know and someone might have missed it out, I am coding in C++.


Is there a point where gpp-compiler did present you with an input prompt? To my knowledge, the compiling packages for Atom aren’t set up to give input prompts (this question comes up about script and atom-runner as well). If you were getting input prompts and now you’re not, then that’s a mystery.


By input prompts, I assume you are referring to entering data via scanf, cin, etc. Indeed, that works even now for simple HelloWorld and addition, multiplication, etc. But for more complicated pieces of code, it wasn’t working, despite the code being correct.

The reason I think there is an error in my setup, and not my code, is because when I make new .cpps for my coding problems, I name them after the problem. Ny original file was named Flipping Game.cpp, and each time cmd sent me an error saying that it wasn’t recognized as an internal or executable file, etc. I noticed that it only showed the address as C:…Flipping as the file address, and so I deleted the whitespace and tried again. Now, it simply skips ahead to the end of the code and says press any key to exit the program.

Is this some sort of bug or something?


What happens if you try to run the file from the command line, with gcc FlippingGame.cpp?

This could happen if gpp-compiler isn’t handling the file name correctly. Shell instructions are mainly separated by spaces. If the package is sending the command gcc Flipping Game.cpp, the compiler has no idea what’s part of the name and what isn’t. gcc "Flipping Game.cpp" is what it should be sending.


So I tried running it on gcc from the cmd line, it returned 1 as the exit status, and threw up like 20 lines of error, all of them something along the lines of

undefined reference to std::cout' undefined reference tostd::ostream::operator<<(long long)'
undefined reference to std::ostream::operator<<(long long)' undefined reference tostd::ios_base::Init::~Init()‘
undefined reference to `std::ios_base::Init::Init()’

and so on.


Funny thing is, I tried the command line gcc on another program, a simple arithmetic one, that Atom could run without any unexpected behaviour using F5. It showed me the same set of undefined reference errors, and returned 1 as exit status.


Oh, damn. I realize what I messed up. gcc is the C compiler. C++ uses g++. So please try g++ FlippingGame.cpp.

(I figured this out after I went and looked at the gpp-compiler code to verify what command it’s sending.)