c++ – Is there a difference between GCC(g++) and Visual Studio?

Question:

I have a couple questions from a beginner.

  1. If a program compiles correctly in VS, will it compile correctly in g++(GCC)? In make?
  2. If a program compiles correctly in VS on Windows 10, will it compile correctly on Linux?
  3. Is it possible to check if the program will compile on Linux and g++(GCC)?

Answer:

I have a couple questions from a beginner.

Not a couple of questions, but three. 🙂

If a program compiles correctly in VS, will it compile correctly in g++(GCC)?

Not a fact, but with some effort it is possible to achieve that it compiles both there and there.

In make?

make itself does not compile anything, make is a build system that uses an external compiler.

If a program compiles correctly in VS on Windows 10, will it compile correctly on Linux?

Again, depending on which compiler you use in Linux. By the way, it can and will compile, but it will not work, since the system calls in Windows and Linux are different.

Is it possible to check if the program will compile on Linux and g++(GCC)?

Of course, there is such a possibility. Install VS and GCC and check.

UPD1:

It is not necessary to install Linux to check the compilability of your program under GCC. There are ports of GCC under Windows.

UPD2:

In connection with the exciting debate of colleagues about the nature of the make utility, I was not too lazy and looked at how this utility is defined in Wikipedia. Here is what is written there:

make is a utility that automates the process of converting files from one form to another. Most often, this is compilation of source code into object files and subsequent linking into executable files or libraries.

The utility uses special makefiles that specify file dependencies from each other and rules for satisfying them. Based on the last modification time of each file, make determines and runs the necessary programs.

Scroll to Top