multithreading in C++

I want to run POSIX multithreaded programs written in C++. I don't have g++ compiler, coz I'm running Vista.

1) Does anyone know of a g++ compiler along with required UNIX files (may some program/tool) that installs on Vista?

2) May be an online g++ compiler, where I could submit my code and it returns with an executable or compilation errors?

Or any other ideas?

Thanks,
Nick
POSIX support (including POSIX threads aka pthreads) have nothing to do with the compiler you are using, but with the platform. So using a Windows version of g++ won't help.

What you need is a POSIX emulation stack for Windows. The most widely used one is probably MinGW : http://www.mingw.org/ (well, to be precise, MinGW does not emulate a POSIX system, but GNU, which is mostly POSIX compliant). In this case, you will continue to use your current compiler (Visual Studio ?), and use the header files and libraries from MinGW.

Another option is Cygwin : http://www.cygwin.com which is a complete Linux-like environment for Windows. Cygwin is different from MinGW in the sense that it can be seen as a complete Linux operating system (and thus it will include all the GNU/Linux toolset, gcc, g++, etc.), but it is heavier.

Now if you only need pthread support, take a look at pthread-win32 (http://sourceware.org/pthreads-win32/), which is a port of the pthread library for Windows, that you can simply include and link it in an existing Visual Studio (or other...) project.

In any case, porting a Unix application to Windows is usually not an easy task, and you should not expect to be able to compile Unix code under Windows without in-depth modifications.


Last edited on
Thanks lloydchristmas,

I was able to install cygwin and ran the basic multithreaded program that night - 2 am :)

Thanks.
Topic archived. No new replies allowed.