How to fix "there was an error in creating a child process for this terminal failed to execute ‘/tmp/<filename>’ (permision denied)"?

  atom-editor, c++, gcc, gnome-terminal

I was trying to run a C++ program from Atom text editor. I have set Gnome Terminal for the gpp compiler.

While I try to compile the program, it shows the error:

There was an error creating the child process for this terminal failed to execute the child process "/tmp/<filename>" (permission denied)

The same program runs in CodeBlocks using the same Gnome Terminal. And further, I have previously run C++ programs from Atom using Gnome Terminal and it worked fine at that time.

How can I fix this issue?

This error seems to pop from nothing. At first, when I installed the gpp compiler and set Gnome Terminal for its output, it worked without any issue. Now, after showing this error in Gnome Terminal, I changed the terminal to X-Term, and it worked fine, the gpp compiler of Atom compiled it without any issue. Even though Gnome Terminal works fine when used with CodeBlocks.

I am using Ubuntu 18.04.

Source: Windows Questions C++