Hello,
Let's we have two files extern.cpp and main.cpp
extern.cpp:
---------------
double e;
--------------
main.cpp
----------------------------
#include <iostream>
using namespace std;
void set()
{
extern double e;
e = 10;
}
int main()
{
set();
#pragma omp parallel for
for (int i = 0 ; i < 10 ; i++)
{
extern double e;
cout<<e<<endl;
}
}
-------------------------
after compilation: icc main.cpp extern.cpp -openmp, program print zeros. For some reason e inside loop became equal 0.
Cheers,
Sergey