#include <omp.h>
#include <iostream>
int main()
{
#pragma omp parallel
std::cout << "Hello from thread "
<< omp_get_thread_num() << ", "
<< "nthreads "
<< omp_get_num_threads()
<< std::endl;
return 0;
}
I include omp.h, but still says:
- undefined reference to `omp_get_num_threads'
- undefined reference to `omp_get_thread_num'
I use g++ 4.71, why still fail to link it?