identifier atomicAdd() and syncthreads() is undefined. How to solve this?

Dear friends, any idea how to solve above two errors?I have tried solving it using all the available suggestions from internet. But still couldnot solve it. I have set in project–>properties–>configuration properties–>CUDA c/c+±->Device

C interleaved in PTXAS output: Yes (–opencc-options -LIST:source=on)
code generation: compute_30,sm_30
Generate GPU debug information: Yes(-G)
Generate Line Number Information: No
Max used register: 0
Verbose PTXAS output: Yes(–ptxas-options=-v)

project–>properties–>configuration properties–>CUDA c/c+±->command line–>additional options–> -arch = sm_30

project–>properties–>configuration properties–>vc++ directories–>include directories–>$(CUDA_INC_PATH)

project–>properties–>configuration properties–>Linker–>General—> (CudaToolkitLibDir);(CUDA_PATH_V6_5)\lib$(Platform)

I am using CUDA 6.5 toolkit, visual studio 2013, windows 64 bit 8.1

After doing all these also still it is showing the errors. Any suggestion how to remove them? Thanks in advance

#include “cuda_runtime.h”
#include “device_launch_parameters.h”

pull in cudadevrt library


thanks…but this I already did…

then it should work

did you use syncthreads() or __syncthreads()…?

project-->properties-->configuration properties-->CUDA c/c++-->command line-->additional options--> -arch = sm_30

that looks like a typo to me… spaces in the additional options. Place in the correct place for it:

Project -> Properties -> Configuration Properties -> Cuda C/C++ -> Device -> Code Generation:


removed the spaces also…but still showing the errors of identifier atomicAdd() and syncthreads() is undefined

Thanks friends.
The solution given in the following link are working fine. I can compile the code correctly. But after compilation I cannot find where the .mexw64 (generated compiled file) file is getting stored. According to the website suggestion, I checked in the following path for the mex file: C:\Program Files (x86)\Microsoft SDKs\Cpp REST SDK for Visual Studio 2013\SDK\bin\x64\Debug
But it was not there as well.

In configuration properties–>General–>Output Directory: (SolutionDir)(Platform)$(Configuration)\

But I am not able to figure out the solution directory path. So, if possible can you suggest me where can I find this output file.

i have the same problem (__syncthreads())is undefined,
also i have an itellisense: expected an expression for the execution of the Global function ( fun_d<<<NbBlocks, NbthreadsPerBlock>>>(x_d, y_d, z_d, n);): for the number of <<<

i add these: but it doesn’t work
#include <cuda.h>
#include <device_functions.h>
#include “cuda_runtime.h”
#include “device_launch_parameters.h”
#include <cuda_runtime_api.h>

if someone has the solution please send me

i found the solution. just put

//for __syncthreads()
#ifndef CUDACC_RTC
#define CUDACC_RTC
#endif // !(CUDACC_RTC)

#include <device_functions.h>