4

Does anyone know of a c/c++ compiler that is easily usable with windows? I have a bit of experience with gcc, but I would like to take a crack at developing some code like this on a windows machine. Many of the compilers I have seen look a bit complex, or are not for windows.

Thanks in advance.

Zack
  • 13,454
  • 24
  • 75
  • 113

9 Answers9

7

Usually on windows the mentality is a bit different. Rather than worrying about a compiler, you worry about getting a good IDE that does all that for you.

As a result, Visual Studio is the best option.

Matt
  • 7,100
  • 3
  • 28
  • 58
  • 1
    It depends on the developer. I use the compiler from Visual Studios---it's the de facto reference compiler for Windows, but I use it mostly from the command line, just as I would any other compiler. For my personal development, I use makefiles, but professionally, I write or edit solution and project files---the GUI in Visual Studios doesn't support doing these in a reasonable manner. In such cases, you can invoke `devenv` from the command line. – James Kanze Feb 21 '12 at 08:37
  • @JamesKanze, I made a generalization, but I think it lives up to its name and is pretty general. When the OP specifically asks for something "easily usable" I think we can assume he doesn't want to know the exact details of the compiler. – Matt Feb 21 '12 at 08:49
  • So it seems like visual studio is a good first place to check out. I will do that. Thanks for the advice everyone! – Zack Feb 21 '12 at 08:52
  • @Mat It's certainly true that there are a lot of programmers using IDEs (both under Windows and elsewhere). The fact that the OP mentions experience using `gcc` may indicate that he is also used to using makefiles and such. In which case, Visual Studios is still the best option (IMHO, at least), even if all you use of it is the compiler itself (`cl`). – James Kanze Feb 21 '12 at 10:24
  • @JamesKanze, Personally my preference is to do all my development in linux with the gcc toolchain and then testing with windows in a vm. I have no experience with using cl, only some experience using Visual Studio with C#, where I did everything in the IDE. Using cl directly is not something I have come across before, but I can believe what you say about it being the de facto standard and so it does make sense. – Matt Feb 21 '12 at 11:11
  • @Mat That's exactly how I develop my own code. Get it working on a Unix platform (today almost always Linux, but for a long time, Solaris), then port to Windows. And my makefiles (GNU make) determine the platform (`$(shell uname...)`) and set things up to invoke the local compiler, g++, Sun CCm or `cl` under Windows. – James Kanze Feb 21 '12 at 12:00
  • Just note that Visual Studio is infamous for its poor C conformance. If you want to learn C, as defined in the C standard, this compiler is most likely a poor choice. – Lundin Feb 21 '12 at 13:48
  • I know the conversation will go towards the Visual Studio in this context but I prefer open source compiler – kta Mar 30 '13 at 14:38
3

Visual Studio Express

MingW (which is gcc IIRC)

Cygwin with the proper packages.

RedX
  • 14,749
  • 1
  • 53
  • 76
3

g++ is available on Windows as MinGW. Alternatively, Microsoft Visual Studio is also an option (the Express version is free.)

NPE
  • 486,780
  • 108
  • 951
  • 1,012
3

Microsoft Visual C++ Express edition: it's good and gratis!

CapelliC
  • 59,646
  • 5
  • 47
  • 90
  • If I got the Visual Studio 2010 C#, would this also compile and run c and c++ code, or should I go with visual c++? – Zack Feb 21 '12 at 08:39
  • 1
    AFAIK, Visual Studio comprises many languages, but Express Edition restricts distribution to a single one. – CapelliC Feb 21 '12 at 08:45
  • @chac: it's free, but I found it dang slow and definitely not *good enough* (really lacking in C++11, too many warts wrt Standard conformance). – Matthieu M. Feb 21 '12 at 08:45
  • 1
    @Matthieu M.: I switched to Ubuntu (currently running 11.04), but here also I'm limited by distro to GCC 4.5 (i.e. I haven't yet touched C++11). Since I'm brushing up my C++, after many year of C#, I don't bother to manually handling the upgrade, for now... – CapelliC Feb 21 '12 at 08:51
3

If you prefer open source and a IDE+compiler-package which is updated more frequently than Visual Studio (this is interesting in times of a new, nowhere fully implemented standard), then this list might be for you:

  • QtCreator + MinGW
  • CodeBlocks + MinGW
  • Eclipse + MinGW

Above is also interesting if you want to learn recent OpenMP versions. (Microsoft seems still not interested in OpenMP 3.x, but instead seems to want to invent yet another parallel framework (as if there is not TBB and/or OpenMP already))

Sebastian Mach
  • 38,570
  • 8
  • 95
  • 130
2

If you don't know where to start, download and install visual studio express from microsoft's website.

Does anyone know of a c/c++ compiler that is easily usable with windows?

Define "easy". As far as I know all compilers are easy to use once you learned how to use decent build system and have toolchain running.

Two main compilers available on windows platform are Microsoft Compiler (Visual Studio express) and MinGW+GCC. There are others (openwatcom/borland c++ builder come to mind), but they are less "popular".

To effictively develop you need 3 main components:

  1. Compiler. (microsoft compiler, gcc, intel compiler, etc)
  2. Build system. (gnu make, scons, cmake, qmake, msbuild, visual studio)
  3. Programmer's text editor. (jedit, visual studio, notepad++, far manager, midnight commander, vim, emacs).

As you can see, there are many possible combinations. For me using gnu command line utilities (from msys) with qmake and visual studio on windows platform turned out to be the most efficient setup.

The main advantage of "all in one" packages like visual studio express is that it installs all 3 components at once. Disadvantage of such package is that a beginner won't understand how program is being built, and as a result newbie won't discover more efficient setup any time soon.

SigTerm
  • 26,089
  • 6
  • 66
  • 115
  • 1
    Borland C++ Builder is "Embarcadero CodeGear C++ Builder" nowadays. I'm using this IDE/compiler myself, and I wouldn't recommend it. The compiler is good, but the IDE is getting worse and worse with every version. More bugs and less documentation seems to be Embarcadero's quality policy. – Lundin Feb 21 '12 at 13:54
  • "To effictively develop you need 3 main components:" I think most Windows devs hold RAD functionality high. What make system the IDE uses is of peripheral interest imo, it should "just work", I don't care how. – Lundin Feb 21 '12 at 13:57
  • @Lundin: "RAD" doesn't necessarily means "IDE". For Qt programming IDE is just a text editor, and it is easier to manage files/dependencies via another build system (qmake) that can generate build scripts or project files for the ide. MSVC has very good text editor - one of the best. However, that's the only reason (I can think of) to use it. As for C++ builder - if you like compiler, use it with different ide/build system. – SigTerm Feb 21 '12 at 15:23
1

You can try Dev-C++ along with mingw. Although, it's like an ant among lions, but it is still the best.

As far as problems like having an older mingw is present, why not get a new one and change some settings. But yes, if u are old school or don't like ides try, Notepad

pratikpc
  • 432
  • 4
  • 12
1

Best options IMHO:

  • Visual c++ Express (best support for Windows development)
  • Eclipse (with CDT) + MinGW (best if you want portable code)
  • Netbeans + MinGW (similar to above)
dbrank0
  • 9,026
  • 2
  • 37
  • 55
0

I have been using OpenWatcom (previously simply Watcom) for close to twenty years and am very pleased with it. The IDE is simple but effective, as is the debugger.

There are some things you should know though:

  • It does not produce 64-bit x86 code
  • The C++ component is for all practical purposes non-existent
  • The root watcom directory cannot reside in a path which contains spaces (i e it can't be placed in "Program Files") so I place it in "Programx" - this quirk may have been fixed
  • I am not sure whether included file functionality can handle embedded spaces in paths either - this may also have been fixed

Tuned C code translated with the Watcom compiler is right up there with the best, especially multi-threaded code.

Olof Forshell
  • 3,169
  • 22
  • 28