Reputation: 525
Currently following the CUDA Getting Started guide for Microsoft Windows [ http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-microsoft-windows/index.html ]; installed CUDA; the samples and NSight; im on Visual Studio 2010; I have checked my card and it supports CUDA. I followed the tutorials up to the demo parts... but I am getting the following error message:
====================================================================================
1>CudaBuild:
1> Compiling CUDA source file bandwidthTest.cu...
1>
1> C:\ProgramData\NVIDIA Corporation\CUDA Samples\v5.0\1_Utilities\bandwidthTest>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.0\bin\nvcc.exe" -gencode=arch=compute_10,code=\"sm_10,compute_10\" -gencode=arch=compute_20,code=\"sm_20,compute_20\" -gencode=arch=compute_30,code=\"sm_30,compute_30\" -gencode=arch=compute_35,code=\"sm_35,compute_35\" --use-local-env --cl-version 2010 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin" -I"./" -I"../../common/inc" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.0\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.0\include" -G --keep-dir "Debug" -maxrregcount=0 --machine 32 --compile -g -DWIN32 -D_MBCS -Xcompiler "/EHsc /W3 /nologo /Od /Zi /RTC1 /MTd " -o "Win32/Debug/bandwidthTest.cu.obj" "C:\ProgramData\NVIDIA Corporation\CUDA Samples\v5.0\1_Utilities\bandwidthTest\bandwidthTest.cu"
1> bandwidthTest.cu
1>C:/ProgramData/NVIDIA Corporation/CUDA Samples/v5.0/1_Utilities/bandwidthTest/bandwidthTest.cu(117): error : identifier "cin" is undefined
1>
1> 1 error detected in the compilation of "C:/Users/James/AppData/Local/Temp/tmpxft_00001654_00000000-14_bandwidthTest.compute_35.cpp1.ii".
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\BuildCustomizations\CUDA 5.0.targets(592,9): error MSB3721: The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.0\bin\nvcc.exe" -gencode=arch=compute_10,code=\"sm_10,compute_10\" -gencode=arch=compute_20,code=\"sm_20,compute_20\" -gencode=arch=compute_30,code=\"sm_30,compute_30\" -gencode=arch=compute_35,code=\"sm_35,compute_35\" --use-local-env --cl-version 2010 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin" -I"./" -I"../../common/inc" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.0\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.0\include" -G --keep-dir "Debug" -maxrregcount=0 --machine 32 --compile -g -DWIN32 -D_MBCS -Xcompiler "/EHsc /W3 /nologo /Od /Zi /RTC1 /MTd " -o "Win32/Debug/bandwidthTest.cu.obj" "C:\ProgramData\NVIDIA Corporation\CUDA Samples\v5.0\1_Utilities\bandwidthTest\bandwidthTest.cu"" exited with code 2.
1>
1>Build FAILED.
====================================================================================
I acknowledge that cin is part of iostream which i have verified is part of my include directive in my code...
I am coming from a web developer's background; I rarely program these types...
Upvotes: 0
Views: 1097
Reputation: 21108
I'm assuming you've modified the bandwidthTest.cu file and this is not the vanilla SDK sample (since a quick check shows it doesn't use cin by default!).
You either need to use std::cin
to explicitely state the scope or add a using namespace std
or using std::cin
to either the top of your file (after including iostream) or the top of the function.
Searching for info on namespaces should give more background, e.g. this tutorial.
If this isn't the problem, then post some code.
Update
From your it seems comment, your real question is how to create a CUDA project in VS2010. See this answer for information on that! Basically you need to create .cu
files in your project and then tell Visual Studio what to do with them (i.e. enable the build customisation).
Upvotes: 2