mingw gcc vs. visual C++

Get answers to all your basic programming questions. No Ogre questions, please!
DrDilbert
Gnoblar
Posts: 5
Joined: Sun Dec 11, 2011 10:29 am

mingw gcc vs. visual C++

Post by DrDilbert »

Hi all,

which compiler do you prefer over the other on windows. Why is that so? I currently think about switching from visual C++ express 2008 to mingw gcc (using eclipse as ide). Are there serious drawbacks (e.g. performance issues?) compiling ogre with gcc on windows. Please share your experiences with me :-)

Thanks!

Dilbert79

P.S. : I'm only talking about the compiler not the ide.
P.S.S: : I hate the visual c++ express ide :-)
User avatar
Klaim
Old One
Posts: 2565
Joined: Sun Sep 11, 2005 1:04 am
Location: Paris, France
x 56

Re: mingw gcc vs. visual C++

Post by Klaim »

Personally the only thing that would make me switch would be if Microsoft continues to not add C++11 features to the compiler.
User avatar
madmarx
OGRE Expert User
OGRE Expert User
Posts: 1671
Joined: Mon Jan 21, 2008 10:26 pm
x 50

Re: mingw gcc vs. visual C++

Post by madmarx »

My only problem with visual C++ is his poor support of C89 preprocessor (and subsequent version).
Can't use chaos preprocessor library directly for example. I need boost.wave instead :( .
Tutorials + Ogre searchable API + more for Ogre1.7 : http://sourceforge.net/projects/so3dtools/
Corresponding thread : http://www.ogre3d.org/forums/viewtopic. ... 93&start=0
CABAListic
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 2903
Joined: Thu Jan 18, 2007 2:48 pm
x 58

Re: mingw gcc vs. visual C++

Post by CABAListic »

With the latest mingw release, Ogre is broken, actually (and I have no idea why). So no, I really can't recommend the switch right now.
User avatar
Klaim
Old One
Posts: 2565
Joined: Sun Sep 11, 2005 1:04 am
Location: Paris, France
x 56

Re: mingw gcc vs. visual C++

Post by Klaim »

User avatar
Mikachu
Gnoll
Posts: 603
Joined: Thu Jul 28, 2005 4:11 pm
Location: Nice, France
x 35

Re: mingw gcc vs. visual C++

Post by Mikachu »

@DrDilbert : I wouldn't advise you to switch, except if you have specific needs (C99, C++0x..)
IMHO, MSVC Debugger >> GDB (performance and usability-wise)...

@MJKlaim : I still had a TDM-GCC installed on my laptop (as it was the previously recommended mingw for Ogre), I tried to build Ogre on that, but the SampleBrowser is still broken with that (silent crash in static initialisation)
OgreProcedural - Procedural Geometry for Ogre3D
DrDilbert
Gnoblar
Posts: 5
Joined: Sun Dec 11, 2011 10:29 am

Re: mingw gcc vs. visual C++

Post by DrDilbert »

Ok, then i will stay with Visual C++. Thx for that. Sadly i also want to use eclipse instead of the Vc express IDE. I know that it is possible to use nmake to do that. But there is a known problem, when using precompiled headers with cmake+nmake. Deactivating precompiled headers is Not an option, because this will increase compile time on my machine dramatically. Any other ideas?
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 535

Re: mingw gcc vs. visual C++

Post by Kojack »

The latest gcc builds have also broken things like arm sd card boot loaders (for things like pandaboard, beagleboard, etc). I had to get an earlier version of the arm gcc toolchain to compile.

Personally the only thing that would make me switch would be if Microsoft continues to not add C++11 features to the compiler.
If that was "continues to be slow at adding C++11 features" I'd agree.
But VC10 added some C++11 features, VC11 added even more features, and we aren't up to sp1 yet (since VC11 isn't fully released). So they are adding C++11 features, just very slowly.
User avatar
Klaim
Old One
Posts: 2565
Joined: Sun Sep 11, 2005 1:04 am
Location: Paris, France
x 56

Re: mingw gcc vs. visual C++

Post by Klaim »

Yes I know how fast they are to add those, I also know that there are suggestions from Herb Sutter that another upgrade of the compiler will come before the VS version coming after VS11.

So as far as they keep adding those features It'll be ok for me. I don't think I'll switch to gcc for windows in a near future. I might play with clang though.
Pierrick584
Halfling
Posts: 42
Joined: Tue Jun 28, 2011 3:56 am

Re: mingw gcc vs. visual C++

Post by Pierrick584 »

personaly i pick mingw for windows for a few reason, first, like everyone SHOULD do, my project aim to be fully multiplatform, and even though i could still use visual studio for the windows version, i'm affraid of having to do some slight mods to the code to make sure everything work everywhere (it could prolly not happend actualy) but i believe beign with mingw would make it more safe, and also, a big point is that using codeblock on every platform make possible to have only one project file for every platform, so i dont have to manage two or three (if i'd use xcode on mac) different IDE. Ok, i know.. technicaly it is possible to use the visual studio compiler in code block, 10.05 doesnt have vc2010 support built in, i'm not too familiar with this, and i dont feel like trying to make it work..

And the last but not least.... Visual Studio is such of an horrible IDE.. cant believe some people actualy use this
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 535

Re: mingw gcc vs. visual C++

Post by Kojack »

cant believe some people actualy use this
I can't believe some people don't. :)
User avatar
Klaim
Old One
Posts: 2565
Joined: Sun Sep 11, 2005 1:04 am
Location: Paris, France
x 56

Re: mingw gcc vs. visual C++

Post by Klaim »

Kojack wrote:
cant believe some people actualy use this
I can't believe some people don't. :)
++
zootlewurdle
Halfling
Posts: 91
Joined: Sat Aug 06, 2011 8:38 am
Location: United Kingdom
x 2

Re: mingw gcc vs. visual C++

Post by zootlewurdle »

/facepalm
TheSHEEEP
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 972
Joined: Mon Jun 02, 2008 6:52 pm
Location: Berlin
x 65

Re: mingw gcc vs. visual C++

Post by TheSHEEEP »

I have to agree with Pierrick584 on this one.

I used VS for years, and yeah, it works, but that's more or less it. As soon as I had to use Eclipse (or NetBeans, can't quite remember) for something else during a project, I started using those whenever possible. The code assisting alone in those IDEs is vastly superior (though I have to say VS2010 really improved compared to the abysmal feature set of 2008 and previous versions).
When developing a multi-platform project, I don't see how using a different IDE on each platform makes any sense, if there is an alternative that works on each platform.
And there are multiple alternatives in the case of Ogre.

Pierrick584 puts Code::Blocks as an alternative. May be true, though IMHO Code::Blocks is the only IDE that is even more ugly and full of design-wtfs than VS. Personally, I use NetBeans (7.1), as that is pretty clear structured, etc. But that all comes down to personal taste. There is NOTHING VS offers that other IDEs I know and use (Eclipse and NetBeans mostly, likely even Code::Blocks) don't. Quite the opposite, as all other IDE always seemed more versatile to me. Have fun developing Java and other non-MS-languages with VS ;)

The true point remains that you can use one IDE to develop the same project on all platforms. If VS would work on all platforms, that would be a valid choice as well, as it would again come down to personal taste.
And I would not say that having a different IDE on each platform has anything to do with taste. It just adds unnecessary complexity, probably even forcing you to use tools like CMake to keep up with that complexity. Use one IDE for all, and you won't need that. Hell, I can start up NetBeans on any platform, compile my Ogre test project and be done with it. And before that, I had to build Ogre from sources on each platform and link correctly. But that is something you have to do once at the start of a project and then likely never touch it again ;)

And Ogre is one of the (rare?) cases where you can use one IDE to rule them all.

Of course, if using the latest GCC on Windows breaks some things in Ogre, that has to be fixed ASAP. And obviously, you can't use GCC then, if you need those things.
My site! - Have a look :)
Also on Twitter - extra fluffy
User avatar
Mikachu
Gnoll
Posts: 603
Joined: Thu Jul 28, 2005 4:11 pm
Location: Nice, France
x 35

Re: mingw gcc vs. visual C++

Post by Mikachu »

@TheSHEEEP : it may be true that VS competitors have improved, but how does the debugger compare to the one integrated with VS? Last time I tried GDB, it was really slow and buggy... almost impossible to use :(
OgreProcedural - Procedural Geometry for Ogre3D
User avatar
lonewolff
Ogre Magi
Posts: 1207
Joined: Wed Dec 28, 2005 12:58 am
x 6

Re: mingw gcc vs. visual C++

Post by lonewolff »

Klaim wrote:
Kojack wrote:
cant believe some people actualy use this
I can't believe some people don't. :)
++
++ & ++
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 535

Re: mingw gcc vs. visual C++

Post by Kojack »

Have fun developing Java and other non-MS-languages with VS
Visual Studio allows other languages to be added to it using the VS SDK Language Services, such as Iron Ruby and Cobra.
There is NOTHING VS offers that other IDEs I know and use (Eclipse and NetBeans mostly, likely even Code::Blocks) don't.
Integrated texture editing, 3d model placement and node based real time shader editing?
Valentin Perrelle
Halfling
Posts: 54
Joined: Thu Sep 15, 2011 4:14 pm
x 2

Re: mingw gcc vs. visual C++

Post by Valentin Perrelle »

I use MinGW for two main reasons :

1/ I want my application to be portable. And i don't mean only PC/Linux, but actually any platform that Ogre can target. This is much more than only windows. If your application compile with MinGW, then you are likely to cross-compile it like you want to.
2/ I'm used to automated build systems now. I use them not only for building, but for many other automated tasks, like packaging, and so on. MSys has good basic command to do all sort of things.

I may add that having your application running on linux as some huge advantages. I had some bug, very hard to spot with a debugguer, and related to wrong memory operations. I used valgrind to find them. Valgrind is a very, very powerful tool, which can spot not-so-obvious errors very fast. But it's on linux. There are some other very good tools on Linux, like profiling in superuser mode, which gives really accurate results.

I mainly stay on windows using Eclipse. (and some plugins like PyDev for editing python script my application uses, Subclipse for svn synchronisation, etc.)

Also note that GCC is a very good compiler (which isn't really important for what i'm doing) but isn't well supported by many software library. Theoritically, when an application support both Windows/VC++ and Linux/GCC, it has no reason to not support MinGW. But, often, developpers are really doing shit, and you will have a hard time to make librairies to compile. Even if it's often a matter of changing #ifdef preprocessor commands.

I don't use gdb much. Only when i have a failed assertion, a segmentation fault or an uncatched exception. Usually, the trace is enough for me to understand what happened. The thing is, the bugs i have are either lost in the middle of recursive algorithms (on trees) which are painful to spot with a debugger or visually noticeable. In both case, a debugger isn't helping much.
CABAListic
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 2903
Joined: Thu Jan 18, 2007 2:48 pm
x 58

Re: mingw gcc vs. visual C++

Post by CABAListic »

Actually, for cross-platform applications I think it is a good idea to make sure it compiles on both GCC (MinGW) and VisualStudio. It usually makes the code more robust and portable because you'll quickly spot if you used some non-standard quirks of either compiler.
Valentin Perrelle
Halfling
Posts: 54
Joined: Thu Sep 15, 2011 4:14 pm
x 2

Re: mingw gcc vs. visual C++

Post by Valentin Perrelle »

CABAListic wrote:Actually, for cross-platform applications I think it is a good idea to make sure it compiles on both GCC (MinGW) and VisualStudio. It usually makes the code more robust and portable because you'll quickly spot if you used some non-standard quirks of either compiler.
GCC has strictly more target platforms. It is thus useless to ensure compatibility with VC. As for the non-standard thing... GCC have many options to select the standard you want to conform to. However, many differences between compilers come from the multiple possible interpretation of the C++ standard. It's funny how two incompatible interpretations can be both correct with respect to the published standards.
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 535

Re: mingw gcc vs. visual C++

Post by Kojack »

Meanwhile Intel's C++ compiler (compatible with both visual studio on windows and gcc on linux) is sitting alone in the corner, wishing somebody would talk to it.
:)
TheSHEEEP
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 972
Joined: Mon Jun 02, 2008 6:52 pm
Location: Berlin
x 65

Re: mingw gcc vs. visual C++

Post by TheSHEEEP »

Never heard of it. Must be a silent guy.
My site! - Have a look :)
Also on Twitter - extra fluffy
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 535

Re: mingw gcc vs. visual C++

Post by Kojack »

It's been around for 10 years. It has auto vectorisation (simd), auto parallelisation (threads), is drop in compatible with visual studio's compiler and gcc (so visual studio can use it as the compiler instead of the ms one), works on linux, mac and windows and has more C++11 features than Visual Studio.
It would probably be a lot more popular if:
- it wasn't $999 for windows and mac users (linux users get it free for non commercial use though)
- they didn't get busted by an antitrust investigation for intentionally sabotaging performance when the code it compiled is run on non Intel cpus.
After getting caught, they now have to warn users that they don't optimise code for non intel cpus. Not running a slow code path when AMD cpus are detected would have been better, but I guess a warning is the best we can hope for from a company like intel.
TheSHEEEP
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 972
Joined: Mon Jun 02, 2008 6:52 pm
Location: Berlin
x 65

Re: mingw gcc vs. visual C++

Post by TheSHEEEP »

Well, yes, THAT would explain alot :)
My site! - Have a look :)
Also on Twitter - extra fluffy
User avatar
Klaim
Old One
Posts: 2565
Joined: Sun Sep 11, 2005 1:04 am
Location: Paris, France
x 56

Re: mingw gcc vs. visual C++

Post by Klaim »

Also, I wish msvc, clang, gcc & intelc++ would provide exactly the same C++ language features (in a coming future I guess).

That way, I wouldn't care which compiler to use.


At the moment, the rational for using MSVC on Windows is simply that it's by far the best compiler there, with a powerful editor available that knows it.
On other platforms it's good to use gcc, but once CLang gets lambda (next version), I'll use CLang instead of gcc as it provide far better compilation performance and better: excellent error reports and code analysis tools.


Build system is irrelevant. Most of us use CMake or similar meta build systems.