gcc - do you recommend it?

Started by
25 comments, last by venzon 15 years, 3 months ago
There are versions of MinGW with GCC 4.3, I wouldn't call that outdated... (and it's nothing unofficial, it's just supposedly not as stable)

Also, GCC is a much better compiler to code with since it is much more standard compliant, and will produce more useful error messages.
I suggest, however, that you write code that is independent of the compiler: stick to standard C++ that will compile everywhere.
Advertisement
Quote:Original post by someboddy
I'm thinking about moving from VC++ to gcc, but before I do that I need to hear some opinions about it from people who use it. Is it any good? Does it have a good intellisense?


The compilers that come with GCC are fine. Even the older MinGW 3.4.5 editions are still better than many other Windows compilers. The newer 4.2.x and 4.3 builds are rather similar to the more recent versions of Microsoft's C++ compiler, at least in terms of standards support. I've had experiences where each has been better at optimizing different pieces of code.

I use them both and have a "neutral" but powerful text editor as my "IDE". In fact most of my projects start out supporting 6 or 7 compilers, but it's often the case that only GCC and VC++ are left after a while as the others can't compile modern C++ code to the same degree.

It's usually not a particularly large matter to port from one to the other if your build system has good support for multiple compilers.

The only thing about MinGW is that is a big negative in my opinion is that the wide character support in its standard library isn't very good. I tend to use utf8 in most places, so this doesn't affect me. But it may be an issue for you.
Quote:Original post by Kwizatz
Quote:Original post by someboddy
For the reason I want to move:

There is nothing wrong with VC++, I just don't think Microsoft released a Linux version of it...


You can use CMake to manage your projects, that way you can use VC++ on Windows and Code::Blocks or Eclipse on Linux without having to maintain multiple build systems.


How close is CMake to the make system used by most Linux distros? I really don't remember the name. It's always just been "make" to me. I got MSYS for Windows but I didn't like it too much. I believe that Code::Blocks supports custom makefiles, but I have no idea what build system it tries to emulate.

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------I once read that World of Warcraft is poor fishing simulator. I don't know about you but I catch a lot more fish in World of Warcraft than I do in real life.
Most unix distros use GNU make. If you really want to run unix utilities, including make, on Windows, consider installing cygwin, Windows Services for Unix or andLinux.
Quote:Original post by kittycat768

How close is CMake to the make system used by most Linux distros? I really don't remember the name. It's always just been "make" to me. I got MSYS for Windows but I didn't like it too much. I believe that Code::Blocks supports custom makefiles, but I have no idea what build system it tries to emulate.


A majority of packages used by linux use autoconf. It's basically a huge shell script (configure), generated by other shell scripts, and which detects libraries installations etc. and generate the makefiles.

cmake operate the same way but is much easier to use. It also have several backends, so by default under linux you use it to generate makefiles, but it can also generate code blocks projects and other stuff.

Under windows, it can generate solutions and projects for visual studio, or makefiles suitable for nmake (distributed with visual studio), using cl.exe (the visual studio compiler) directly.

It abstracts a lot of option settings, and provide modules to locate various library installation paths at configuration time (you can implement your own). It supports building in a completely separate directory from the source. You can even describe where to install your files and it can then automatically generate tarballs, debian packages or even nsis installers for windows (you can include installation-specific informations such as the nsis installer icon etc.).

There's a lot of built-in build functions, unlike make where you have to painfully write every rule by hand. So you can for instance build a dll/shared object just by writing something like:

add_library( name SHARED xxx.cpp yyy.cpp zzz.cpp ) and it'll do the right thing according to your target and compiler. You do need a bit of compiler specific option setting (cmake 2.4 wasn't setting -fPIC everywhere needed automatically when using gcc for instance), but that's only a couple IFs to test for the compiler type to stick somewhere.

It's really nice to work with. My engine involve some messy process where an idl compiler is built first, then used to generate a bunch of headers needed to build subsequent things. I've easily been able to set this all up with cmake in a way where all the required dependencies work perfectly well. I tried to use scons in the past and it became messy quickly when doing slightly complicated stuff.
Quote:Original post by kittycat768
How close is CMake to the make system used by most Linux distros? I really don't remember the name. It's always just been "make" to me. I got MSYS for Windows but I didn't like it too much. I believe that Code::Blocks supports custom makefiles, but I have no idea what build system it tries to emulate.


CMake can generate makefiles as well, it is similar to autotools but not as complex, CMake is sort of a meta build system, what it does is generate project files or makefiles based on the information about the sources you supply, the environment you're on, the IDE you tell it to use, etc.
I use gcc under Linux and Windows for cross-platform game development and recommend it.

For my build system I use SCons, which works under Linux and Windows (with MSYS/minigw and python installed). Personally, I can't stand autotools.

Under Linux my IDE of choice is KDevelop, and under Windows I just use Notepad++ (I mostly program in Linux).

You asked about intellisense; several free IDEs/text editors support something similar (code completion) through a program called Ctags:
http://en.wikipedia.org/wiki/Ctags#Editors_that_support_ctags

[Edited by - venzon on January 13, 2009 11:04:03 PM]

This topic is closed to new replies.

Advertisement