Jump to content


Best C++ Compiler


38 replies to this topic

#1 Computerrock

    New Member

  • Members
  • PipPip
  • 10 posts

Posted 27 November 2008 - 02:53 AM

What opensource compiler is powerful, easy to use, and works well with C++ engines?

#2 Reedbeta

    DevMaster Staff

  • Administrators
  • 5308 posts
  • LocationSanta Clara, CA

Posted 27 November 2008 - 07:47 AM

Windows flavor: MinGW.
Linux/Mac flavor: gcc.
reedbeta.com - developer blog, OpenGL demos, and other projects

#3 .oisyn

    DevMaster Staff

  • Moderators
  • 1842 posts

Posted 27 November 2008 - 12:51 PM

Do you really mean opensource or just free? Because the express edition of Visual C++ is free and pretty good too. Although it doesn't optimize as heavily as the (non-free) professional version if I'm not mistaken.
C++ addict
-
Currently working on: the 3D engine for Tomb Raider.

#4 martinsm

    Member

  • Members
  • PipPip
  • 88 posts

Posted 27 November 2008 - 08:17 PM

hm.. Really? I all the time though that compiler (cl.exe/link.exe and their functionality) from express VS versions does not differ from professional version. Only some libraries or IDE features are missing.

#5 .oisyn

    DevMaster Staff

  • Moderators
  • 1842 posts

Posted 27 November 2008 - 08:19 PM

That might very well be. I only know that in the past (VS 2003 and before) the Professional edition came with the optimizing compiler while the standard edition didn't, and I also thought that was true for the Express edition, but I'm not certain about that.

.edit: it seems that you are right. VC++ Express is lacking 64 bit support (but you can get the command line compiler with the Windows SDK), a resource editor, and ATL, MFC or OpenMP support. http://en.wikipedia....C.2B.2B_Express
C++ addict
-
Currently working on: the 3D engine for Tomb Raider.

#6 JarkkoL

    Senior Member

  • Members
  • PipPipPipPip
  • 475 posts

Posted 27 November 2008 - 10:42 PM

Only problem with Express edition for me is the lack of plugins, so you can't have Visual Assist nor Perforce integration. Otherwise it's a good compiler + IDE.

#7 .oisyn

    DevMaster Staff

  • Moderators
  • 1842 posts

Posted 28 November 2008 - 12:47 AM

Yeah no Visual Assist is a bummer, but perforce integration sucks anyway, especially if the server is not located in the same building let alone the same country (which has more to do with VS' implementation of source control handling - it takes a LOT of roundtrips to get information about all the files). I've created a set of macro's that allows you to add, edit, revert and delete files using a toolbar button (for the active open document) or the solution explorer context menu. It also has the option to edit all unsaved files at once, and it can remap file paths based on a config file if you happen to use NTFS junctions (or any other reason for discrepancies between file paths and the perforce client spec). I bet these macros work in Express as well :)
C++ addict
-
Currently working on: the 3D engine for Tomb Raider.

#8 leoptimus

    New Member

  • Members
  • PipPip
  • 24 posts

Posted 28 November 2008 - 01:05 AM

Quote

What opensource compiler is powerful, easy to use, and works well with C++ engines?

Compiler:
If you're refering to open source, the only choise is GCC( gcc for linux, also known as MingW fow windows). Yes, there are other opensource compilers too but they're all useless.

If you're looking for free compilers, they're only two: GCC and Microsfot c++ Compiler version 8-9 express. But GCC is much better because is more standard and its usability is the same for PC, Consoles (Wii, PS2,PSP,PS3,DS, Dreamcast, Nokia, Palm, Iphone), Mac, Solaris etc. Microsoft Compilers are only for windows.

GCC manages the C++ language compilation following ansi standards, while Microsoft doesn't. Some times the c++ code made for Microsoft compilers are totally incompatible for other compilers (gcc, intel) . Microsoft promotes to break standards and encourages totally dependency to its unique plattform (windows).

Also, GCC supports more languages than c++, like D, Pascal, ADA, Java,ObjetiveC, Fotran etc. Microsoft only C++, nevertheless you want to use .NET framework for programming in other languages like C#.

IDE

Compilers , Easy to use? never, because tipically compilers aren't easy to use. All of them need to be used in similar ways: command line primitives, and they aren't obvious.

But may you're refering to IDEs for programming in c++. There are four c++:
  • Visual Studio C++ IDE 2005 - 2008: The most used, the most popular. It isn't easy to use at all. Complete features. Robust interface for debugging code. Responsible and accurate Intellisense. Configuring projects on it is a little complicated. A little bloat and consumes machine resources. MultiCompiler??

  • Code::Blocks: Open source and free. The easiest to use IDE. Crossplatform. Lightweight. Has intellisense, but not always accurate. Its editor is similar to Visual Studio but I found it more easier for navigating through the code. It allows to configurate projects very easy. Productive. Multi-Compiler : VC, GCC, Intel.

  • Netbeans.Open source and free. Crossplatform. Similar to Visual Studio IDE, but more heavyweight and bloater. Works for c++ through a plugin (that's bad). Consumes a lot of machine resources. ITs intellisense is not always accurated. Debugging code on it is not as pleasurable as on Visual Studio or CodeBlocks. Not so productive. Multi-Compiler : VC, GCC, Intel. works with many languages: java, c++, php etc.
  • Eclipse. Open source and free. Crossplatform. Similar to Visual Studio IDE, but more heavyweight and bloater. Works for c++ through a plugin (that's bad). Consumes a lot of machine resources. ITs intellisense is not always accurated. Debugging code on it is a totally hell. Not so productive. Hard to use. Multi-Compiler : VC, GCC, Intel. works with many languages: java, c++, php etc.

For c++ engines:

If you have to use DirectX, the only choice is Microsoft Visual Studio C++ because DirectX is microsoft stuff. Otherwise I highly recommend Code::Blocks for everything, the most productive IDE. And also I highly recommend GCC above the 4.1 version, because is a very efficient compiler and produces faster executables, and also has more hardware profiles than Microsoft (support for Core 2 Duo).

But if you want the most efficient applications for c++, you should work with Intel Compiler, which isn't free. However, GCC 4X produces applications with a closer performance to the ones produced by Intel compiler.

#9 Reedbeta

    DevMaster Staff

  • Administrators
  • 5308 posts
  • LocationSanta Clara, CA

Posted 28 November 2008 - 03:13 AM

.oisyn said:

I've created a set of macro's that allows you to add, edit, revert and delete files using a toolbar button (for the active open document) or the solution explorer context menu.

Cool. I just have Ctrl+E bound as an "external tool" that `p4 edit`s the active file and everything else I do through p4v (Perforce GUI).
reedbeta.com - developer blog, OpenGL demos, and other projects

#10 Sol_HSA

    Senior Member

  • Members
  • PipPipPipPip
  • 510 posts
  • LocationNowhere whenever

Posted 28 November 2008 - 10:59 AM

leoptimus said:

Compiler:
If you're refering to open source, the only choise is GCC( gcc for linux, also known as MingW fow windows). Yes, there are other opensource compilers too but they're all useless.

If for some mysterious reason you need to make a 16-bit DOS application, openwatcom can't be beat. =)
http://iki.fi/sol - my schtuphh

#11 .oisyn

    DevMaster Staff

  • Moderators
  • 1842 posts

Posted 28 November 2008 - 11:40 AM

leoptimus said:

Compiler:
If you're looking for free compilers, they're only two: GCC and Microsfot c++ Compiler version 8-9 express. But GCC is much better because is more standard and its usability is the same for PC, Consoles (Wii, PS2,PSP,PS3,DS, Dreamcast, Nokia, Palm, Iphone), Mac, Solaris etc. Microsoft Compilers are only for windows.
And Xbox. And since this is a gamedevelopment forum Windows and Xbox might just very well be the only things you need :)

Quote

GCC manages the C++ language compilation following ansi standards, while Microsoft doesn't.
I'm sorry but this is just plain bullshit from the top shelf. I think your arguments come from the pre 2003 age. Since 2003 there were a LOT of improvements to ISO C++ compliancy in VC++. There are a few non-compliant issues, but gcc has those as well. There is only one group of true ISO C++ compliant compilers, and those are the ones based on the EDG C++ compiler front-end (such as Intel C++, Comeau, Borland C++ Builder X, ...).

As for the rest of your post, stop spreading your FUD.
C++ addict
-
Currently working on: the 3D engine for Tomb Raider.

#12 anubis

    Senior Member

  • Members
  • PipPipPipPip
  • 2225 posts

Posted 28 November 2008 - 08:20 PM

Quote

I'm sorry but this is just plain bullshit from the top shelf. I think your arguments come from the pre 2003 age. Since 2003 there were a LOT of improvements to ISO C++ compliance in VC++. There are a few non-compliant issues, but gcc has those as well.

I would prefer gcc for philosophical reasons but it's true that VS had some serious improvements over the last years. If you enable ISO C++ mode in VC++ it's a lot more picky than gcc.

Anyone who still remebers the for (int i=0; ...; ...) bug in VC 6 is bound to hate it. I currently port a lot of code between Linux and Windows tough and need to keep it working on both platforms. I have to say that the issue is hardly there anymore. Most of the stuff I am really concerned with is missing POSIX stuff in VS but that's a thing they never promised in the first place, so I can't complain about that.

I might add that in my experience VC++ is no match for gcc 4.1 upwards regarding performance. That is a highly opinionated statement though and I don't have hard data to back it up.
If Prolog is the answer, what is the question ?

#13 anubis

    Senior Member

  • Members
  • PipPipPipPip
  • 2225 posts

Posted 28 November 2008 - 08:26 PM

Also gcc allows quite a bit of non standard code that is used in the linux kernel :)
If Prolog is the answer, what is the question ?

#14 Reedbeta

    DevMaster Staff

  • Administrators
  • 5308 posts
  • LocationSanta Clara, CA

Posted 28 November 2008 - 10:53 PM

anubis said:

I might add that in my experience VC++ is no match for gcc 4.1 upwards regarding performance.

Do you mean in terms of compilation performance or performance of the generated code? On larger projects, or smallish ones?

I've seen VC++'s optimizer to be generally superior to that of gcc. As for the compilation performance, it's hard to say, but I feel like VC++ might be slightly better at incremental compilation, i.e. recompiling only things that have been affected by a code change. Like you, though, I don't have any hard data on this.
reedbeta.com - developer blog, OpenGL demos, and other projects

#15 .oisyn

    DevMaster Staff

  • Moderators
  • 1842 posts

Posted 28 November 2008 - 11:50 PM

anubis said:

I currently port a lot of code between Linux and Windows tough and need to keep it working on both platforms. I have to say that the issue is hardly there anymore.
I agree. I use both compilers, MSVC++ for Windows and 360, GCC for PS3, and I have yet to write a piece of code that doesn't work out of the box on any one of the compilers. I also think both compilers somewhat grew to eachother with respect of non-standard stuff. Think about VC++'s __declspec and gcc's __attribute__. They pretty much buth support the same type of stuff like alignment, and you can put it in the same position in a declaration, which makes it easy to use a single cross-platform macro. IIRC, in the early days it wasn't that easy because the __attribute__ had to be put in a different spot than the __declspec, forcing the coder to use two macros.

Quote

I might add that in my experience VC++ is no match for gcc 4.1 upwards regarding performance.
I don't really have an opinion as I use the compilers on different platforms, but I've seen both lots of impressive stuff and stuff that makes you think "OMG WHY?!" with both compilers.
C++ addict
-
Currently working on: the 3D engine for Tomb Raider.

#16 leoptimus

    New Member

  • Members
  • PipPip
  • 24 posts

Posted 29 November 2008 - 12:47 AM

Reedbeta said:

Do you mean in terms of compilation performance or performance of the generated code? On larger projects, or smallish ones?

About generated code, GCC 4.2 (Mingw) and Microsoft C++ compiler, both always produce efficient and optimized applications. Some programs run faster when they're generated with Mingw, and other could run faster if they're compiled with Microsoft C++ compiler. There are a lot of aspects that makes an application more hardware efficient. F.E: the STL library from GCC it's more efficent that the one present in Microsoft Visual C++ (in my personal benchmarks), but SIMD code could be a little faster if it is generated on Visual Studio.

The story was different in times of GCC prior to 4x version (2.x to 3.3); in that time GCC couldn't beat Microsoft in generated code.

About compilation time, VC++ has been always the fastest. But the difference is not noticeable comparing with gcc, even for big projects (with more than 1000 source files the difference is only about minutes (3-5)).

The choice is that if you want cross-platform, you should use GCC for everything. The fact is that is really hard to make cross-platform code with VC++. You must decide between Windows and Open-Standards.

But if the Windows world is what you think that only matters, go straight foward with Microsoft Visual Studio.

#17 anubis

    Senior Member

  • Members
  • PipPipPipPip
  • 2225 posts

Posted 29 November 2008 - 01:06 AM

I just really really hate at&t assembly syntax :) So on that I'd pick VC's inline assembly any day. Allthough I seldomly use it anymore...

Quote

Do you mean in terms of compilation performance or performance of the generated code?

Execution performance. What I base this on is ray tracing and modelling algorithms I have implemented. I don't know if gcc is able to optimize certain areas especially well. As I said... I'm not claiming truth on this :)
If Prolog is the answer, what is the question ?

#18 SamuraiCrow

    Senior Member

  • Members
  • PipPipPipPip
  • 459 posts

Posted 29 November 2008 - 01:44 AM

Actually, LLVM-GCC is a special version of GCC that will work on most platforms once compiled. It differs from standard GCC in that it uses the Low-Level Virtual Machine (http://www.llvm.org/) which generates code more quickly than standard GCC and debatably can make cleaner code than standard GCC also.

-edit-
As of version 2.4 of LLVM, 64-bit Windows is still unsupported. That is slated to come in version 2.5.

#19 SmokingRope

    Valued Member

  • Members
  • PipPipPip
  • 210 posts

Posted 29 November 2008 - 03:21 AM

leoptimus said:

Compiler:
If you have to use DirectX, the only choice is Microsoft Visual Studio C++ because DirectX is microsoft stuff.

Is there any validity to this statement? I have not tried MinGW (for example) and DirectX but would be rather surprised if it is not possible.

#20 Reedbeta

    DevMaster Staff

  • Administrators
  • 5308 posts
  • LocationSanta Clara, CA

Posted 29 November 2008 - 05:00 AM

leoptimus said:

The fact is that is really hard to make cross-platform code with VC++. You must decide between Windows and Open-Standards.

Actually, I've developed a couple projects (luabridge as well as my raytracer, "stanley"), that compile in both MSVC and gcc, and I didn't have much trouble at all getting both builds to compile warning free from one code base.
reedbeta.com - developer blog, OpenGL demos, and other projects





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users