Is this the right way to run C codes?


#1

I’m a Windows user and learning C language. I use gpp compiler to run my C codes in Atom.


It compiles the code and give you the output right there but don’t produce the exe file.


#2

I don’t write C, but it seems to me like gpp-compiler should make an executable. If you’re seeing it act in a way you don’t expect, you can open an issue on the GitHub repo.

One thing to check out before you do that, though. I was examining the code and I found this config setting, which suggests that the package may be compiling to a temporary directory. We can see what that means here.

function getCompiledPath(dir, base) {
  debug("getCompiledPath()", dir, base);

  if (atom.config.get("gpp-compiler.compileToTmpDirectory")) {
    return path.join(os.tmpdir(), base);
  } else {
    return path.join(dir, base);
  }
}

Then getCompiledPath() gets fed from const info which is the path to the file you’re running. So if you don’t have that config set, it should add your current directory on as the compile destination.

Considering all that, I hypothesize that you can fix your issue by going to Settings -> Packages, selecting gpp-compiler, and scrolling down in its settings until you find a checkbox marked Compile to Temporary Directory. Uncheck it and try to compile your code.