Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What tool exists to compile C++2011 code for Windows target?

I created a program in C++2011 that actually uses features of C++2011: mutex, unique_lock, condition_variable, future and async.

I've tested it on Debian Linux 64 bits box, and it compiles and runs like a charm.


Now, I want to compile it for Windows.

I tried Visual C++ Express 2010, but it does not have support for the new features of C++. (The Beta for Visual C++/Studio 2012 only runs on Windows 8.)

I tried cross compiling with mingw-g++ (4.6), but it looks like these new features are not supported for the Windows target. (Although they are supported for g++-4.6 for Linux target).

Is there any (free?) solution as of today to compile a C++2011 program for Windows target?

like image 359
Didier Trosset Avatar asked Apr 04 '12 13:04

Didier Trosset


People also ask

Can Windows compile c code?

The Visual Studio build tools include a C compiler that you can use to create everything from basic console programs to full Windows Desktop applications, mobile apps, and more.


2 Answers

My (commercial) Just::Thread library provides std::thread, std::mutex and friends for MSVC 2005/2008/2010 and the TDM port of mingw-gcc 4.5/4.6 on Windows. It's not free, though.

Alternatively, look for a build of gcc 4.7 for mingw. Support for the thread library on Windows is supposed to be available out-of-the-box with gcc 4.7, but it's not officially released yet.

like image 149
Anthony Williams Avatar answered Oct 19 '22 22:10

Anthony Williams


I have not tried it yet, but this quote from the project site sounds promising:

"Builds support the following technologies:

OpenMP
LTO
Graphite
std_threads
std_atomics 

..."

http://code.google.com/p/mingw-builds/

hope this helps

like image 23
IcemanX Avatar answered Oct 19 '22 22:10

IcemanX