Reputation: 21
I try to run some openMP examples in visual studio, but when enable the /openMP the program could not work, return the error "MSB6006: “CL.exe” exited with code 2". Here is the example:
int main(int argc, char* argv[]) {
#pragma omp parallel {
printf("Hello World... from thread = %d\n", omp_get_thread_num());
}
return 0;
}
Thank you for your help.
Upvotes: 2
Views: 1534
Reputation: 71
When you use openMP then the "two-phase name lookup" option cannot be used. This is indicated in Output Window where you can see this message:
1>c1xx: error C2338: two-phase name lookup is not supported for C++/CLI, C++/CX, or OpenMP; use /Zc:twoPhase-
To fix that go to "Project Properties"-> "C/C++" -> "Command Line" and add /Zc:twoPhase- in "Additional Options" in bottom section and press Ok. That fixed my problem.
Upvotes: 5