title: Parallel program giving error "Undefined reference to _Kmpc_ok_to_fork"
body: <p>I am trying to compile the OPENMP fortran code on linux. I have around 230 subroutines. The code I used to compile the code is as follows:
  1) At first I compiled each subroutine with the following command</p>
  
  <pre><code>ifort -c -override-limits -openmp *.for
  </code></pre>
  
  <p>Then all the subroutines have now a separate object file. </p>
  
  <p>2) Then I tried to compile the object files to the executable by the following command</p>
  
  <pre><code>ifort *.o -o myprogram
  </code></pre>
  
  <p>I got the following error :</p>
  
  <pre><code>WINDWAVE.F90:(.text+0x1c9d): undefined reference to `__kmpc_global_thread_num'
  WINDWAVE.F90:(.text+0x1cb0): undefined reference to `__kmpc_ok_to_fork'
  WINDWAVE.F90:(.text+0x1eea): undefined reference to `__kmpc_fork_call'
  WINDWAVE.F90:(.text+0x1f09): undefined reference to `__kmpc_serialized_parallel'
  WINDWAVE.F90:(.text+0x214b): undefined reference to `__kmpc_end_serialized_parallel'
  WINDWAVE.F90:(.text+0x2427): undefined reference to `__kmpc_for_static_init_4' 
  WINDWAVE.F90:(.text+0x29c7): undefined reference to `__kmpc_for_static_fini'
  WINDWAVE.F90:(.text+0x29da): undefined reference to `__kmpc_barrier'
  WINDWAVE.F90:(.text+0x2a50): undefined reference to `__kmpc_for_static_init_4'
  WINDWAVE.F90:(.text+0x3773): undefined reference to `__kmpc_for_static_fini'
  WINDWAVE.F90:(.text+0x3786): undefined reference to `__kmpc_barrier'
  WINDWAVE.F90:(.text+0x37fc): undefined reference to `__kmpc_for_static_init_4'
  WINDWAVE.F90:(.text+0x4a58): undefined reference to `__kmpc_for_static_fini'
  WINDWAVE.F90:(.text+0x4a6b): undefined reference to `__kmpc_barrier'
  WINDWAVE.F90:(.text+0x4a8f): undefined reference to `__kmpc_single'
  WINDWAVE.F90:(.text+0x4d18): undefined reference to `__kmpc_end_single'
  WINDWAVE.F90:(.text+0x4d2b): undefined reference to `__kmpc_barrier'
  WINDWAVE.F90:(.text+0x4da9): undefined reference to `__kmpc_for_static_init_4'
  WINDWAVE.F90:(.text+0x4fc5): undefined reference to `__kmpc_for_static_fini'
  WINDWAVE.F90:(.text+0x4fd8): undefined reference to `__kmpc_barrier'
  WINDWAVE.F90:(.text+0x504e): undefined reference to `__kmpc_for_static_init_4'
  WINDWAVE.F90:(.text+0x596f): undefined reference to `__kmpc_for_static_fini'
  WINDWAVE.F90:(.text+0x5982): undefined reference to `__kmpc_barrier'
  WINDWAVE.F90:(.text+0x59fb): undefined reference to `__kmpc_for_static_init_4'
  WINDWAVE.F90:(.text+0x6369): undefined reference to `__kmpc_for_static_fini'
  WINDWAVE.F90:(.text+0x637c): undefined reference to `__kmpc_barrier'
  WINDWAVE.F90:(.text+0x63f2): undefined reference to `__kmpc_for_static_init_4'
  WINDWAVE.F90:(.text+0x6b8d): undefined reference to `__kmpc_for_static_fini'
  WINDWAVE.F90:(.text+0x6ba0): undefined reference to `__kmpc_barrier'
  WINDWAVE.o: In function `windwave_mp_fetch_':
  WINDWAVE.F90:(.text+0x9cfd): undefined reference to `__kmpc_global_thread_num'
  WINDWAVE.F90:(.text+0x9d10): undefined reference to `__kmpc_ok_to_fork'
  WINDWAVE.F90:(.text+0x9da0): undefined reference to `__kmpc_fork_call'
  WINDWAVE.F90:(.text+0x9dbc): undefined reference to `__kmpc_serialized_parallel'
  WINDWAVE.F90:(.text+0x9e59): undefined reference to `__kmpc_end_serialized_parallel'
  WINDWAVE.F90:(.text+0xa0ea): undefined reference to `__kmpc_for_static_init_4'
  WINDWAVE.F90:(.text+0xa109): undefined reference to `__kmpc_for_static_fini'
  WINDWAVE.F90:(.text+0xa118): undefined reference to `__kmpc_barrier'
  </code></pre>
  
  <p>I am using intel 13 composer to compile the program. I didn't know how to use link with libiomp5md . </p>
  
  <p>Please help me get rid of this error. I tried several times but I couldn't get this error. </p>
  
  <p>If I don't use the openmp flag the program runs but it doesn't treat as openmp program. </p>
  
  <p>Thanks </p>
  
  <p>Jdbaba</p>