OpenCV link error

I tried to build an openCV code using gcc and I link the libm.so.6 file to the compiler, but I get the following error.

gcc -lm /lib/arm-linux-gnueabihf/libm.so.6 OpenCV_Tests.c pkg-config --cflags --libs opencv

/usr/bin/ld: /tmp/ccve61Id.o: undefined reference to symbol ‘lrint@@GLIBC_2.4
/usr/bin/ld: note: ‘lrint@@GLIBC_2.4’ is defined in DSO /usr/lib/gcc/arm-linux-gnueabihf/4.7/…/…/…/arm-linux-gnueabihf/libm.so so try adding
it to the linker command line
/usr/lib/gcc/arm-linux-gnueabihf/4.7/…/…/…/arm-linux-gnueabihf/libm.so: could not read symbols: Invalid operation

Please give any suggestions to do this.
Thanks.