about cutCreateTimer(); to test time

Hi, I want to use
cutCreateTimer(&timer),cutStartTimer(timer),cutStopTimer(timer) …and so on
to test the running time,but I got these:

/tmp/tmpxft_0000101d_00000000-12_addSquare2.o: In function main': tmpxft_0000101d_00000000-11_addSquare2.ii:(.text+0xdef8): undefined reference to cutCreateTimer’
tmpxft_0000101d_00000000-11_addSquare2.ii:(.text+0xdf1b): undefined reference to cutStartTimer' tmpxft_0000101d_00000000-11_addSquare2.ii:(.text+0xe049): undefined reference to cutStopTimer’
tmpxft_0000101d_00000000-11_addSquare2.ii:(.text+0xe06c): undefined reference to cutGetTimerValue' tmpxft_0000101d_00000000-11_addSquare2.ii:(.text+0xe087): undefined reference to cutDeleteTimer’
collect2: ld return 1

it seems to be a problem with “cutil.h,” actually I have compiled as below (with some includes and libs):

[root@localhost mycuda]# nvcc -o addSquare2 addSquare2.cu -I /root/NVIDIA_CUDA_SDK/common/inc/ -L /root/NVIDIA_CUDA_SDK/lib/

and already done
#include <cutil.h>
#include <cutil_inline.h>

What should I do?

To solve the problem you have to link with libcutil, which is in the SDK, but better still, change your code to use native GPU event timers, because the SDK cutil library isn’t intended for anything serious.

I guess you should have “common” inserted in /root/NVIDIA_CUDA_SDK/lib/ also - like /root/NVIDIA_CUDA_SDK/common/lib/

Not entirely sure where the variable NVIDIA_CUDA_SDK is pointing to, but the inc and lib libraries should both be under the “common” folder? :)

It seems like the folder you are providing where your libraries are placed, is wrong.

Regards, Tainruk