0

I compile with this command:

g++.exe -g a.cpp -o a.exe

And the compiler does full a compilation even if there are no changes in a.cpp from a previous compilation. How to skip compilation, if there are no changes in the source file?

user3324131
  • 923
  • 8
  • 10
  • 7
    You're going to need a build system for this. related/dupe: https://stackoverflow.com/questions/52034997/how-to-make-makefile-recompile-when-a-header-file-is-changed – NathanOliver Jun 08 '21 at 18:34
  • 1
    The compiler does what it is told to do. You said compile; it compiled. It is the build system that invokes the compiler that knows whether or not it needs compiling. That might be a `makefile` and one of the many variants of `make`; it might be `cmake`; it might be part of the IDE you use; it might be one of the many alternatives to `make` that exist. – Jonathan Leffler Jun 08 '21 at 20:39
  • I use visual studio code with C++ extension. Seems it not has this functionality. – user3324131 Jun 08 '21 at 21:12

0 Answers0