1

I am trying to run the following code in VS code:

#include <stdio.h>
#include "omp.h"

int main()
{
    #pragma omp parallel
    {
        int ID  = omp_get_thread_num();
        printf("hello(%d)",ID);
        printf("world(%d\n",ID);
    }
    return 0;
}

I am getting this error:

[Running] cd "c:\Users\nokni\OneDrive\Υπολογιστής\C C++\" && gcc test.c -o test && "c:\Users\nokni\OneDrive\Υπολογιστής\C C++\"test
C:\Users\nokni\AppData\Local\Temp\ccKN9XFE.o:test.c:(.text+0xe): undefined reference to `omp_get_thread_num'
collect2.exe: error: ld returned 1 exit status

Any suggestions?

Jokerp
  • 213
  • 1
  • 9

0 Answers0