Error compiling test program

I am trying to compile a sample program I wrote myself to learn CUDA

The purpose of the program is to calculate PI, and it worked fine when I had the kernel function and main in one file.

Now, I moved the kernel function into another file and compiled it into a CUBIN, and want to load it using CUmoduleload

When I compile the code, I get these two errors:

tmpxft_000041a8_00000000-11_assign.ii:(.text+0x9d70): undefined reference to `cuModuleLoad’

tmpxft_000041a8_00000000-11_assign.ii:(.text+0x9d8a): undefined reference to `cuModuleGetFunction’

here is my code:

[codebox]#include <stdio.h>

#include <cuda.h>

#include <cuda_runtime.h>

#define SIZE 512

int main()

{

//the end result will be copied into this array

float *hResult;

hResult = (float*)malloc(sizeof(float) * SIZE);

//allocate space on device

float *dResult;

cudaMalloc((void**) &dResult, sizeof(float) * SIZE);

CUmodule hModule;

CUfunction hFunction;

cuModuleLoad(&hModule, “pi.cubin”);

cuModuleGetFunction(&hFunction, hModule, “calcPi”);[/codebox]

Are you linking against libcuda.so, or libcudart.so?

N.