Why g ++ does not overwrite the executable

So, I am trying to emigrate from Windows to Linux. Today I am trying to encode and compile files using Emacs instead of the Windows IDE. This is my sample code:

#include <iostream> using namespace std; int main() { cout << "HELLO" << endl; } 

What I compiled from emacs using esc-x-> compile-> g ++ -o hello hello.cpp

From the terminal, I said hello using './hello'. Then I changed my code to 'cout <<"HOLA FFS" <enp; "and tried to compile with g ++ -o hello hello.cpp again. The compilation ended without errors, but when I tried to say hi from the terminal, the output was" HELLO ", not" HOLA FFS ".

Why is this done?

+4
source share
2 answers

You should check the accepted answer to this question:

Fastest Emacs Compilation Process?

Basically the code from there (which you should paste into ~/.emacs ) will be:

  • save file automatically
  • generate a Makefile if it does not already exist
  • run compile
  • If compile completed successfully, run the program; otherwise, display the first error.

And all this with f5 :)

0
source

A possible reason is that you did not save the code after changing the code. I do not think this is necessarily related to emacs. Remember Cx Cs often.

+2
source

Source: https://habr.com/ru/post/1492451/


All Articles