CUDA integration with MFC

Hi, im trying to integrate some CUDA kernells into an aplication that uses MFC and having this errors:

1>LIBCMT.lib(calloc.obj) : error LNK2005: allready defined _calloc en libcmtd.lib(dbgheap.obj)

I dont know how to integrate both *.cu and *.cpp with MFC to compile properly…

Any help? thanks!

PD: This is some code:
CPP:

#include “stdafx.h”
#include “CudaGrid.h”
#include “DataLoader.h”
#include

extern “C”
unsigned int
CudaCreateTimer();

CU:
#include <cutil.h>

extern “C”
unsigned int
CudaCreateTimer()
{
// create and start timer
unsigned int timer = 0;
cutCreateTimer(&timer);
cutStartTimer(timer);
return timer;
}

Not that you have to, but depending on what you’re using CUDA for, you might be better off taking the CUDA code and rolling it into it’s own DLL, which you could then call from your MFC application. This keeps things a bit more separated so it’s easier to code, portable, etc.

Also, how are you getting this error? Running in EmuDebug/Debug/EmuRelease/Release mode?

Debug Mode, i will ask my teacher how to compile funcitions to a .dll file.

Thank you!