Question

I'm taking an Introduction to C++ this semester, so I need to set up development environments in both my Windows and Ubuntu partitions (I switch between them). I was planning to use GCC in both environments for consistency and because I plan to do my serious C++ developing in Linux with GCC.

It appears that installing MSYS and MinGW is the best way to use GCC and replicate my Linux dev environment. However, just setting up MSYS and MinGW in Windows appears to be a long and arduous process, and I'm imagining that I will have limitations or compatibility problems in the future.

  • Do the benefits of setting up a MSYS Linux-like development environment on Windows outweigh the costs?
  • Will I be able to use all the libraries that I could if I were using Visual C++?
Was it helpful?

Solution

I think you're going about this the wrong way - I would actually suggest you use Visual Studio on the Windows environment, rather than going out of your way to setup GCC. It's a benefit, not a drawback, to run your code on multiple compilers from multiple vendors.

Both GCC and Visual Studio are highly conformant (at least recent versions). You won't have any trouble with standard libraries and going between them, and if you do have trouble, it's probably an issue in your code.

OTHER TIPS

I've always installed cygwin on Windows. To me, Windows is completely unusable without it. I've never really run into problems with DLLs mentioned above. However, I've also rarely used the GCC compiler, so I don't know how it compares to Visual Studio for general programming. For anything with a Windows GUI or Dot Net based, I would definitely stick with Visual Studio.

If you stick with the automated installer, MinGW installation is not painful at all. Unfortunately, that currently gives you GCC 3.4.5, rather than the newer 4.4.0 release that they also provide sans installer.

In reality, for course work, 3.4.5 will be just fine, I imagine.

Use gcc on Ubuntu and Visual Studio on Windows to get exposure to both. This is an intro course so Windows, Linux, Visual Studio, gcc are just the tools you need to master C++ and data structures. Mastering the tools will come over time and they will change.

I personally develop for windows using a pure Linux environment using mingw-gcc on Linux to cross-compile for windows. I put a tutorial on how to set it up for OpenSSL/Qt4 @ http://www.limitlessfx.com

Do you do this to get .exes or just to be able to work on both OSes?

If you feel more comfortable with GCC than VC, setting up Mingw/Cygwin is possible but doesn't give you any new functionality (beside .exes). Instead, I suggest you turn one of your partitions into a virtual machine - this way you can have both OSes open at once! (My personal choice is Windows inside Linux, YMMV.)

The benefit of developing on Linux is ready availability of tons of development tools and libraries. Also, big builds are noticably faster.

Since you said "I plan to do my serious C++ developing in Linux with GCC", VC++ may not be what you really want. Many libraries just don't compile well in VC++. Try some yourself. Instead, consider running Linux on Windows. There are several ways to do this:

  1. Use PuTTY to connect to a Linux machine, and use Xming to see the UI windows. I would only do this over a LAN.
  2. Consider coLinux. You can run Linux under Windows and just shut-off Linux when you are done.
  3. Consider other virtualization options like VMWare to run Linux. Pretty much the same as coLinux, but it might be easier to setup.

You may even want to install Linux directly on your machine. You can always use tools like Wine or VMWare to run Windows if you need it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top