I just installed openMP just running
- brew install gcc
Then I compiled my code using
- gcc-10 -o task -fopenmp task.c
However I got the error message:
Undefined symbols for architecture x86_64: "_main", referenced from: implicit entry/start for main executable ld: symbol(s) not found for architecture x86_64 collect2: error: ld returned 1 exit status
my code is:
1. #include <omp.h>
2. #include <iostream>
3. using namespace std; 
4.
5. #define TAMA_NTHREADS 4
6.
7.
8. int main (int argc, const char * argv[]){
9.
10.    
11.   int nProcessors = omp_get_max_threads();
12.
13.   cout<<"Numero di core disponibili: " << nProcessors << endl;
14.
15.   omp_set_num_threads(nProcessors);
16.
17.   cout << "Numero thread fuori pragma: " << omp_get_num_threads() << endl;
18.
19.   #pragma omp parallel
20.      {
21.         cout << endl <<"Numero di thread in pragma: " << omp_get_num_threads() << endl;
22.         cout << "Sono il thread numero: " << omp_get_thread_num(); 
23.         cout << " E ti saluto! " << endl; 
24.      }
25.   
26.   exit(0);
27.}
May someone help me please?
