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

I have a couple of 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 whether the program will compile in Linux and in g++(GCC)?
Author: Саша Шумейко, 2020-01-28

1 answers

I have a couple of questions from a beginner.

Not a couple of questions, but three.: -)

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

Not a fact, but with some effort, you can make it compile both there and there.

In make?

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

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

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

Is there a way to check whether the program will compile in Linux and in g++(GCC)?

Of course, there is such a possibility. Put VS and GCC and checking it out.

UPD1:

You don't have to install Linux to check the compilability of your program under GCC. There are GCC ports under Windows.

UPD2:

In connection with the fascinating dispute of colleagues about the nature of the make utility, I was not too lazy and looked at how Wikipedia defines this utility. Here's what it says:

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

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

 3
Author: pepsicoca1, 2020-02-01 07:16:57