Difference between Betwen Visual C ++ 2008 and g ++

I am learning C ++, and when I tested Microsoft Visual C ++ 2008 Express and Eclipse Ganymede, but with the default g ++ compiler, I noticed that the same code in VC ++ gets some errors and compiles fine in g ++, without errors or warnings will work fine, but I want to know what is the difference between VC ++ syntax and g ++ syntax? Thanks!

+4
source share
3 answers

Please add this to Paul's answer:

If you are developing a cross-platform product, use g ++ ( MingW ) and adhere to the C ++ standard. Use the POSIX-compliant APIs provided by MingW where standard tools do not serve this purpose. An executable file created using MingW does not require special runtime for the target system, but VC ++ 2008 requires this. Thus, deployment is easier with MingW applications.

The advantage of VC ++ is its excellent development environment. The Microsoft compiler also seems to perform some special Windows optimizations.

However, MingW, complemented by CodeBlocks , the IDE can provide you with a great, free, cross-platform C ++ development environment.

0
source

I can’t comment because I'm new (reputation is not yet 50), but here is another question that relates to a similar topic:

Compiling differences in Visual C ++ and * nix environments

+13
source

This is a very broad topic. Both compilers generally comply with the C ++ ISO with some exceptions, but these exceptions may differ (for example, VC ++ considers the throw specifier for functions in a non-standard way, and g ++ is standard in this regard). In addition, both compilers provide a fairly large number of extensions that are mostly mutually incompatible (for example, VC ++ __property and __property , or g ++ typeof and computed goto). In general, the best advice here is to familiarize yourself with the documentation of any product. If you have any specific code that you are having problems with and would like to know why it compiles with one and not the other, then you could answer in more detail.

+4
source

All Articles