0

I just did an example project "Hello world" with openMP just to see how it works.

Here is the code:

    #include <omp.h>
    #include <iostream>
    using namespace std;


    int main()
    {
       #pragma omp parallel
       {
          cout <<"Hello World\n";
       }

          return 0;
     }

from what I understood it suppose to print "Hello world" multi-times (as the number of the processors, no?) I mean that if I have a dual core it suppose to print this line 2 times, am I right? anyway it prints just one time, and I wonder why? I'm using Visual Studio 10 and running the code from there..

2
  • 1
    Have you enabled OMP in your VS project? Commented Nov 24, 2013 at 17:09
  • OpenMP relies on compiler support to be available, it's not a library or some piece of source code from third parties, you should document yourself about how to do OpenMP programming with your compiler. Commented Nov 24, 2013 at 17:55

1 Answer 1

2

You should enable Open MP support in your Visual Studio (Properties -> C/C++ -> Language -> Open MP Support -> Yes).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.