8

I'd like to make a big project of mine buildable on Windows platforms. The project itself it's written in C/C++ following POSIX standards, with some library dependencies such as libxml2, libcurl and so on. I'm more a Linux developer rather than a Windows developer, so i have no idea of which compiler suite i should use to port the code. Which one offers more compatibility with gcc 4.4.3 i'm using right now?

My project needs flex and bison, is there any "ready to use" environment to port such projects to windows platforms?

Thanks.

Simone Margaritelli
  • 4,584
  • 10
  • 45
  • 70

4 Answers4

12

If it were me, I would install the following:

This is effectively the environment I do my own programming in, and it works very well. If you want an IDE, I'd recommend Code::Blocks, but both gvim and emacs are available for Windows too.

  • Btw, http://sourceforge.net/projects/mingw/files/ has most updated tools on Unix/Linux for Windows. @Simone: That URL has most updated version of Bison & Flex that you need. GNUWin32 has historical versions but are quite good. It's up to you to choose. – Viet Apr 23 '10 at 16:44
  • Neil--thanks for pointing out Twilight Dragon--I've been frustrated with mingw.org's installers & slow release timeline & didn't know that alternative distros were out there. – Drew Hall Apr 23 '10 at 22:52
4

If you don't use any UNIX system calls so you can run on Windows freely. There are flex & bison for windows too: http://gnuwin32.sourceforge.net/packages.html . You can go ahead with MinGW: http://www.mingw.org/ .

If you have UNIX system calls, then you have to use cygwin: http://www.cygwin.com/ , http://en.wikipedia.org/wiki/Cygwin .

Viet
  • 17,944
  • 33
  • 103
  • 135
  • Probably i'm going to port the code using precompiling directives to determine the OS i'm on, so even if there're some unix calls it's not a big issue. – Simone Margaritelli Apr 23 '10 at 16:01
  • If you don't mind writing OS-specific system calls so the macros with MinGW are sufficient. If writing Windows code to replace those UNIX-specific system calls are problems for you, use Cygwin. But remember that DLL by Cygwin is GPLed: http://www.cygwin.com/ml/cygwin/1999-07/msg00348.html. – Viet Apr 23 '10 at 16:15
1

I very much doubt either cygwin nor mingw is up to 4.4.3 yet. I would bet on being able to upgrade the compiler in mingw to be easier.

You'll need cygwin if you're actually using any Linux specific stuff. The libraries you listed off aren't an issue I don't think. POSIX could be, depending.

Edward Strange
  • 40,307
  • 7
  • 73
  • 125
  • @Neil: Official MinGW distribution has guarantee of quality and release schedule. Projects such as KDE and Nokia Qt rely on the official MinGW. Btw, it's not always a good idea to jump from 4.4.3 straight to 4.5.0, in case of incompatibility. Btw, the official MinGW also has 4.5.0. The previous version that it distributes was 4.4.0, not the patched/updated 4.4.3. – Viet Apr 23 '10 at 16:41
  • @Viet I've had no problems (the opposite in fact) with the TD version I recommended in my answer. I've never used the nuwen version seriously, but it is easy to install, so I thought I'd mention it. And I will do almost anything to avoid using the MinGW website :-) –  Apr 23 '10 at 16:47
  • @Neil: I bookmarked the official MinGW download page actually, to avoid reading that spaghetti site ;) – Viet Apr 23 '10 at 16:54
1

A nice new alternative is Cygnal. The basic idea:

  • First, compile the code under Cygwin for Cygwin itself using its "native" toolchain (not MinGW).
  • Next, deploy the program with the Cygnal version of the Cygwin DLL.

Cygnal is a fork of the primary Cygwin DLL which changes certain behaviors which are too Unix like.

Cygwin's motto is "get that Linux feeling on Windows". Cygnal tones down that feeling; it brings back some of the Windows feeling to programs, so that those programs work for Windows users outside of the Cygwin environment using Windows conventions.

Programs understand native paths, and such. None of the rich API functionality in Cygwin is removed, only a small portion of it is adjusted.

Kaz
  • 55,781
  • 9
  • 100
  • 149