Page 1 of 3

mingw gcc vs. visual C++

Posted: Sat Jan 28, 2012 10:33 am
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 :-)

Re: mingw gcc vs. visual C++

Posted: Sat Jan 28, 2012 10:36 am
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.

Re: mingw gcc vs. visual C++

Posted: Sat Jan 28, 2012 11:03 am
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 :( .

Re: mingw gcc vs. visual C++

Posted: Sat Jan 28, 2012 11:11 am
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.

Re: mingw gcc vs. visual C++

Posted: Sat Jan 28, 2012 1:10 pm
by Klaim

Re: mingw gcc vs. visual C++

Posted: Sat Jan 28, 2012 2:06 pm
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)

Re: mingw gcc vs. visual C++

Posted: Sat Jan 28, 2012 3:04 pm
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?

Re: mingw gcc vs. visual C++

Posted: Sun Jan 29, 2012 12:24 am
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.

Re: mingw gcc vs. visual C++

Posted: Mon Jan 30, 2012 12:02 am
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.

Re: mingw gcc vs. visual C++

Posted: Sun Mar 04, 2012 3:32 pm
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

Re: mingw gcc vs. visual C++

Posted: Sun Mar 04, 2012 5:01 pm
by Kojack
cant believe some people actualy use this
I can't believe some people don't. :)

Re: mingw gcc vs. visual C++

Posted: Sun Mar 04, 2012 8:36 pm
by Klaim
Kojack wrote:
cant believe some people actualy use this
I can't believe some people don't. :)
++

Re: mingw gcc vs. visual C++

Posted: Mon Mar 05, 2012 3:31 pm
by zootlewurdle
/facepalm

Re: mingw gcc vs. visual C++

Posted: Tue Mar 06, 2012 10:26 am
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.

Re: mingw gcc vs. visual C++

Posted: Tue Mar 06, 2012 10:53 am
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 :(

Re: mingw gcc vs. visual C++

Posted: Tue Mar 06, 2012 11:46 am
by lonewolff
Klaim wrote:
Kojack wrote:
cant believe some people actualy use this
I can't believe some people don't. :)
++
++ & ++

Re: mingw gcc vs. visual C++

Posted: Tue Mar 06, 2012 7:19 pm
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?

Re: mingw gcc vs. visual C++

Posted: Tue Mar 06, 2012 7:29 pm
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.

Re: mingw gcc vs. visual C++

Posted: Tue Mar 06, 2012 8:54 pm
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.

Re: mingw gcc vs. visual C++

Posted: Tue Mar 06, 2012 9:59 pm
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.

Re: mingw gcc vs. visual C++

Posted: Wed Mar 07, 2012 2:30 am
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.
:)

Re: mingw gcc vs. visual C++

Posted: Wed Mar 07, 2012 12:28 pm
by TheSHEEEP
Never heard of it. Must be a silent guy.

Re: mingw gcc vs. visual C++

Posted: Wed Mar 07, 2012 3:38 pm
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.

Re: mingw gcc vs. visual C++

Posted: Wed Mar 07, 2012 4:17 pm
by TheSHEEEP
Well, yes, THAT would explain alot :)

Re: mingw gcc vs. visual C++

Posted: Wed Mar 07, 2012 10:27 pm
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.