cuda in cpp (c++) how to make a cuda c++ cuda

i am new to the cuda i need some sample for cuda c++,i know that cuda run even on c. but c++ is easier to code please help me to get cuda on c++.

The syntax for a kernel should be the same for both. What’s your problem when trying with c++ ?

Pretty much all of the SDK examples, and those in the programming guide and other docs are in c++. (Which is a source of considerable irritation, BTW.) In fact, I had to search through the boards here to discover the couple of tricks needed to include CUDA code in a normal C program.

i am getting the following error using ubuntu cuda 2.3,program kernel written in c++ and i am using emulation mode

root@ubuntu:~/Desktop/final# nvcc --device-emulation --compiler-bindir=/usr/bin/gcc-4.3 -deviceemu final.cu -o run
final.cu(65): warning: variable “filename” was declared but never referenced

final.cu(65): warning: variable “filename” was declared but never referenced

In file included from /tmp/tmpxft_00000925_00000000-1_final.cudafe1.stub.c:5,
from final.cu:110:
final.cu: In function ‘void __cuda_emu::_Z7analysev()’:
final.cu:39: error: ‘_Z8tostringPc’ was not declared in this scope
final.cu:39: error: ‘_ZNSsaSERKSs’ was not declared in this scope
final.cu:39: error: ‘_ZNSsD1Ev’ was not declared in this scope
final.cu:44: error: ‘_ZNSsC1ERKSs’ was not declared in this scope
final.cu:44: error: ‘_Z8findwordSsSs’ was not declared in this scope
final.cu:52: error: ‘_ZNSsC1ERKSs’ was not declared in this scope
final.cu:52: error: ‘_Z8findwordSsSs’ was not declared in this scope

From the name decoration visible in the error messages (such as “_Z8tostringPc”) it looks like a case of C++ code mistakenly compiled as C code or vice-versa (C++ compilers do name decoration that C ones do not, hence the compiler gets lost).

Can you post the contents of “final.cu” ( possibly on a pastebin like http://ideone.com/ )?

You may also try experimenting with the --host-compilation option, described here: The Official NVIDIA Forums | NVIDIA

If anything, the current docs are here: CUDA Toolkit Documentation 12.3 Update 1