Community
cancel
Showing results for 
Search instead for 
Did you mean: 
James_B_14
Beginner
99 Views

Problem with Ifort and drand48()

I have C code like such:

#include <stdlib.h>
#include <stdio.h>
#include <math.h>
main(){
    double x[10000];
    int i;
    srand48(123);
    for (i - 0; i<10000; i++){
       x = tan(3.0*drand48());
    }
}

I compile it with icc:

icc -c rand.c

I link it with ifort:

ifort -nofor-main rand.o -lm

This works with the older ifort 12.0.4 and with gcc 4.4.7, but does not work with ifort 13.0.1

0 Kudos
4 Replies
James_B_14
Beginner
99 Views

I get the error "undefined reference to 'simd_drand48_pd64x2'

Steven_L_Intel1
Employee
99 Views

You probably need to specify some icc libraries that ifort doesn't link to. I am moving this to the Intel C++ forum where C++ experts can advise you.

Casey
Beginner
99 Views

The library you need is libirng.so.  You can link your code with ifrort using the command line:

$ ifort -nofor-main rand.o -lirng

(I tracked this down looking at the symbol table of the binary linked with icc.)

James_B_14
Beginner
99 Views

That worked Casey.  Thank you for your help!