Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ compiler differences [closed]

What's the difference on the VC++.net complier (cl.exe /EHsc) and the GCC compiler, compiling, let's say this program:

#include <iostream>
using namespace std;

int main(){
 unsigned int test;
 cin >> test;
 cout << test;
 return 0;
}

I know that the vc++ compiler compiles to an exe, and gcc is compiling to the linux executable, and that's about it. but what's the real difference?

Edit: I thinking about the difference down to a lower level. Let me make this a little more clear. What's the difference between the same program compiled in 2 different C++ compiler on the same platform (win or linux doesn't matter).

like image 615
Pwnna Avatar asked Jan 22 '23 11:01

Pwnna


2 Answers

GCC means the GNU Compiler Collection, it is the front end for a collection of compilers and linkers. When compiling C++ it will usually call g++.

As for g++ vs VC++, they are completely different compilers so there are a ton of differences.

For example they will optimize code in different ways, they may have minor syntactical differences based on not following the standard correctly, different libraries, different headers, different implementations, etc...

g++ can be used to compile projects on various different platforms, whereas VC++ is meant to only compile programs for the Windows platform.

like image 132
Brian R. Bondy Avatar answered Jan 24 '23 01:01

Brian R. Bondy


I think, different runtime libraries.

like image 33
Boris Avatar answered Jan 24 '23 01:01

Boris