Create a cuda project in VS 2005 VS 2005 can not understand the syntax

Hi every body. Iam a new member in the Cuda
I had compiled some program in the NVIDIA project and it can work.
when i make a new project (my project store in the NVIDIA project)
in my project i has a function i had stored it on the *.cu file

global void testKernel( float* g_idata, float* g_odata)

when I build this project I get 2 errors :(

error C2144: syntax error : ‘void’ should be preceded by ‘;’
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

so i type this string before the function

extern “C”
global void testKernel( float* g_idata, float* g_odata)


But it still did not work. as the same errors :no:

(iam a vietnamese so my english is not good)

I had made some tutorial on Linux and it worked. :)
but I spend alot of time for cuda on window but it can not work :(
please help me
thank you very much :heart:

You should make a copy of the project “template” located in SDK/Project directory, and start from that. Don’t create a project from begin if you are not a expert.

You need to make a build rule for .cu files, as in you need to tell VS to compile .cu files with the nvcc compiler.
There was a thread long time back about the same…so be sure to check it out.
Alternatively you could open any nVidia projects and right click on any .cu file in the solution explorer and inspect its properties. Look for Custom build step and you will know whats going on. That is your .cu build rule.

In the mean-while you can use the template project (or any other existing project) and tailor it to suit your needs.


Thank you 54wo and psycloXPS :))

I had copy all NVIDIA CUDA SDK and past on another direction

and then i open matrixMulDrv project which store in the projects folder

and build. It work. :))

so I delete the code they write inside of these function

and replace my code on it.

i did’t change any header (the #include some header file)

In the *.cu file I write 2 functions

(1) to tranfer data from CPU to GPU and call kernel function (2)

(2) kernel function

in the *cpp file I write main function

and when I call the (1) function from *.cpp file

I get 2 errors :(


matrixMulDrv.obj : error LNK2019: unresolved external symbol "void cdecl data(int)" (?data@@YAXH@Z) referenced in function _main

…/…/bin/win32/Release/matrixMulDrv.exe : fatal error LNK1120: 1 unresolved externals

Build log was saved at “file://c:\Documents and Settings\vinh\Desktop\IMAGE PROCESSING PROJECT\b Send data to GPU\NVIDIA CUDA SDK\projects\readcpu to gpu1\Release\BuildLog.htm”

matrixMulDrv - 2 error(s), 0 warning(s)

========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I am sure to say that my function doesn’t has any error, because it was very simple function and i check it many times. and the compiler did not show any error about these function

I try to fix these problems, I found some idear from msdn forums but until now i can’t <img src=‘http://hqnveipbwb20/public/style_emoticons/<#EMO_DIR#>/crying.gif’ class=‘bbc_emoticon’ alt=’:’(’ />

Hi everybody

I can not solve my problem so i try with another way

I creat an another solution and save out of Nvidia folder

include build rule from JaredHoberock

and follow all steps :)

C++ Additional Includes:

“$(CUDA_INC_PATH)”;“C:/Program Files/NVIDIA Corporation/NVIDIA CUDA SDK/common/inc”

Linker Additional Libs:

“$(CUDA_LIB_PATH)”;“C:/Program Files/NVIDIA Corporation/NVIDIA CUDA SDK/common/lib”

Linker Input:

cudart.lib cutil32D.lib cutil.lib

when i compile *.cu file, it is ok

when build this solution i had the same error


getting_start_cuda1.obj : warning LNK4075: ignoring ‘/EDITANDCONTINUE’ due to ‘/INCREMENTAL:NO’ specification

LINK : warning LNK4098: defaultlib ‘MSVCRTD’ conflicts with use of other libs; use /NODEFAULTLIB:library

getting_start_cuda1.obj : error LNK2019: unresolved external symbol “void __cdecl data_tranfer(float *,float *,float *)” (?data_tranfer@@YAXPAM00@Z) referenced in function _wmain

C:\Documents and Settings\vinh\Desktop\getting_start_cuda1\Debug\getting_start_cuda1/run.exe : fatal error LNK1120: 1 unresolved externals

Build log was saved at “file://c:\Documents and Settings\vinh\Desktop\getting_start_cuda1\getting_start_cuda1\Debug\BuildLog.htm”

getting_start_cuda1 - 2 error(s), 2 warning(s)

========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Please help me. i spend alot of time to create my own CUDA program o VISUAL STUDIO C++ 2005 :(

I am too stupid.
I had solved my problem. :D

just type extern “C” on the prototype

extern “C”{void data_tranfer(float *A1,float *B1,float *C1);};

void data_tranfer(float *A1,float *B1,float *C1);

thank you everybody.