Linking error between c++ and cuda file

I am creating a project that captures images continuously and performs a fast fourier transforms on the images. I have created a simple outline of the project with a c++ file that captures images, a cuda file that will (hopefully) perform the fast fourier transform, and a header file that will link the two so I can call the function “fastft” from the main.cpp. I am using cuds’s cuFFT library. After creating two object files main.o and fft.o, when I go to compile with g++ I receive the error:
“In function main': main.cpp:(.text+0x47c): undefined reference to fastft(int, int, unsigned char*)”

This might be a simple fix, but I was unable to find help elsewhere. Also, feel free to make any recommendations that can improve the cuda program. I am new to cuda programming so any advice helps.

header.h

// header.h

#ifndef _HEADER_H
#define _HEADER_H

#include <iostream>

void fastft(int width, int height, unsigned char* image);

#endif

fft.cu

#include <cufft.h>
#include <cuda_runtime.h>
#include <cuda.h>
#include <cuda_device_runtime_api.h>

#include <iostream>
#include <stdlib.h>
#include <stdio.h>

#include "header.h"

void fastft(int width, int height, cufftReal* data)
{
cufftHandle plan;
cufftComplex *transform;
//Allocate memory
cudaMallocManaged((void**)&data, sizeof(cufftReal)*width*height); 
cudaMallocManaged((void**)&transform, sizeof(cufftComplex)*width*height); 
//Create Plan
cufftPlan2d(&plan, width, height, CUFFT_R2C)
//Execute fft
cufftExecR2C(plan, data, transform); 
//Destroy plan
cufftDestroy(plan);
//Free memory
cudaFree(data);
cudaFree(transform);
//Message
std::cout << "This program may have worked" << std::endl;
}

main.cpp

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/opencv.hpp>
#include "FlyCapture2.h"
#include <iostream>
#include "header.h"

using namespace FlyCapture2;




int main()
{
    Camera camera;
    Error error;
    CameraInfo camInfo;

    // Connect the camera
    error = camera.Connect( 0 );
    if ( error != PGRERROR_OK )
    {
std::cout << "Failed to connect to camera" << std::endl;
        return false;
    }

    // Get the camera info and print it out
    error = camera.GetCameraInfo( &camInfo );
    if ( error != PGRERROR_OK )
    {
        std::cout << "Failed to get camera info from camera" << std::endl;
        return false;
    }
    std::cout << camInfo.vendorName << " "
                  << camInfo.modelName << " "
                  << camInfo.serialNumber << std::endl;

     // Start Capture
        error = camera.StartCapture();
    if ( error == PGRERROR_ISOCH_BANDWIDTH_EXCEEDED )
    {
        std::cout << "Bandwidth exceeded" << std::endl;
        return false;
    }
    else if ( error != PGRERROR_OK )
    {
        std::cout << "Failed to start image capture" << std::endl;
        return false;
    }

    // capture loop
        char key = 0;
    while(key != 'q')
        {
                // Get the image
                Image rawImage;
                Error error = camera.RetrieveBuffer( &rawImage );
                if ( error != PGRERROR_OK )
                {
                        std::cout << "capture error" << std::endl;
                continue;
                }

        // Convert the raw image
        Image convertedImage;
        rawImage.Convert( FlyCapture2::PIXEL_FORMAT_MONO8, &convertedImage);

        // convert to OpenCV Mat
                unsigned int rowBytes = (double)convertedImage.GetReceivedDataSize()/(double)convertedImage.GetRows();
                cv::Mat image = cv::Mat(convertedImage.GetRows(), convertedImage.GetCols(), CV_8UC1 , convertedImage.GetData(),rowBytes);
                cv::imshow("image", image);
                key = cv::waitKey(30);

        // Call cuda function
        int height, width;
        height = 964;
        width = 1288;
        fastft(width, height, image.data);
        }

    error = camera.StopCapture();
    if ( error != PGRERROR_OK )
    {
        // This may fail when the camera was removed, so don't show 
        // an error message
    }

        camera.Disconnect();

        return 0;
}

Perhaps you are new to C/C++ programming as well. THe problem here is pretty straight forward, your function prototype in the header file:

void fastft(int width, int height, unsigned char* image);

does not match your definition:

fft.cu

void fastft(int width, int height, cufftReal* data)
{

or usage:

fastft(width, height, image.data);

The third parameter/argument type is different.

They need to match.

This has nothing to do with CUDA programming.

Thanks Bob.