views:

298

answers:

3

How can I get OpenMP set up in VC++ 2008? The compiler supports it, I believe I am only missing headers/libs. Can I obtain them similar to how the framework SDK can be added to VC++ Express for MFC development?

A: 

Afaik, only professional editions come with OpenMP.

An alternative is to use Cygwin and download the c/c++ development packages (gcc 4.2 is the default i think and it'll have OpenMP supported)

Raymond Tay
That's a horrible alternative :) And not really workable on this project really, which is strongly VS-based. I've _used_ OMP on VS before (2005 express probably), in fact I wrote articles about it... so I'm confused how I managed to get it to work before!
John
A: 

The Windows SDK and WDK have traditionally come with the C/C++ compilers for the various platforms. These compilers often have features enabled that do not come with the express versions of VS.

Two such features used to be included:

  • Support for OpenMP
  • Support for PREfast

(I say all this in the past tense because it's been awhile since I've installed a Windows DK.)

So it's easy enough to get the compiler for free. The trick will then be to replace VS's cl with the appropriate one from the dev kit.

Frank Krueger
+1  A: 

You need to enable OpenMP support in the C++ project properties (this is a compiler option).

You also need to #include <omp.h> in any source file where you are using OpenMP pragmas and/or library calls. This bit me, as the documentation says the include is only needed when making library calls, but not for using pragmas alone. But the documentation is wrong. The omp.h header updates the manifest of your executable so the run-time library can be found (vcomp.dll).