I’ve made a simple VS2005 Project Wizard for CUDA. After you install the CUDA VS2005 Wizard, you can see the CUDAWin32App in your Visual Studio installed templates Category. Then it’s easy to create a new CUDA project in VS2005.
This is first version only made in two days. So if there is any problem please let me know.
PS: Thanks JaredHoberock’s “Simple CUDA build rule for Visual Studio 2005”.
The new version:
Modify two bug:
1, Change the CUDA_LIB_PATH into CUDA_INC_PAHT;
2, Add debug info into EmuDebug;
I’ve just had a Windows reinstall and a clean install of VS2005 and CUDA toolkit. I’ve found a little inconvenience. By default, the sample code has:
#include <cuda_runtime.h>
The <…> mean the include file is searched within VS specified includes directory, which is not yet set for CUDA after a fresh install.
I usually add CUDA/include dir into VC++ directories anyway but to make this wizard foolproof you might want to add a rule to account for it (is possible) :)
I used the VS2005 Project Wizard to create a new project…
But my VS couldn’t fine the <cutil.h> & <cuda_runtime.h>…
How to include the directory to tell VS the correct path and get the *.h
I check “template” (SDK project) and "wizard project "…
the “template” vcproj file includes the “CUDA_INC_PATH”
but the "wizard project " doesn’t have it …
Is the main reason that my VS couldn’t find the <cutil.h> & <cuda_runtime.h>…?
But the error is not here. It’s me made a mistake in the Wizard set the -I with $(CUDA_LIB_PATH). It should be CUDA_INC_PATH. - -hehe I will update it in the next version.
BTW, the include <…> means search from the INCLUDE environment and the directories that specified by the /I compiler option.
I’ve did that and now an error occurs during linking:
Linking...
LINK : fatal error LNK1104: cannot open file '.\Debug\CUDAWin32App1.obj'
Build log was saved at "file://d:\projekty_dev\test2\CUDAWin32App1\CUDAWin32App1\Debug\BuildLog.htm"
I’ve added the build log as an attachment. BuildLog.htm (6.2 KB)
I can compile and link in EmuDebug mode but when I try to debug it, VS says “Debugging information cannot be found or does not match. Binary was not built with debug information”. I fixed this by manually editing Properties->Linker->Debugging and setting Generate Debug Info to on, as per Debug configuration.
EmuRelease works fine.
Ordinary Debug does what I described earlier.
Release mode gives me:
LINK : fatal error LNK1181: cannot open input file '.\release\wizardtest.obj'
Build log was saved at "file://d:\NVIDIA CUDA SDK\projects\wizardTest\wizardTest\Release\BuildLog.htm"
wizardtest - 1 error(s), 0 warning(s)
(build log in attachment)
I compared build logs from the failed Release and Debug modes with the successfully linked Emu modes and found one difference:
One of the command lines looks like this in Release build log:
/OUT:"Release\wizardtest.exe"
And here’s the successfully linked EmuRelease
/OUT:"D:\NVIDIA CUDA SDK\projects\wizardtest\EmuRelease\wizardtest.exe"
I noticed EmuRelease version has a complete path and Release doesn’t. Can this be the case? If so, how to fix it?
Edit: I changed it so that all configurations use complete paths and it didn’t help.
thanks for your great wizard.
I tried to add additional header files to the helloCuda project (my name of the project is CUDAOraTest). I set an additional full include path to the folder containing the additional header file, but I only get the project running, if I place the header file in the same directory as the .cu file.
If the headerfile is in the directory “C:\Paddy\Programmierung\CUDAOracle\CUDAOraTest\CUDAOraTest” everything is working fine. If i move the headerfile to “C:\Paddy\Programmierung\CUDAOracle\CUDAOraTest\CUDAOraTest\inc” the compiler doesn’t find the header file.
I tried to include the headerfile with <headerfile.h> and “headerfile.h”, both not working.
What am I doing wrong?
Can you help me? I’d like to get more structure to my project with “inc” and “src” folder.
I guess you add the headerfile by the VS2005 directly. And then move the headerfile into inc directory?
If so, first you should delete it from the project, second move the file into inc directory, and then add the file into the project.
When you use the headerfile, it doesn’t need to add the “-IC:\Paddy\Programmierung\CUDAOracle\CUDAOraTest\CUDAOraTest\inc”, if you create the headerfile yourself.
And you can use it in your source file like this: include “./inc/headerfile.h”, that the source file is in the CUDAOraTest category, and the headerfile is in the CUDAOraTest\inc category.
When I use include “./inc/headerfile.h” it’s working. But now the compiler doesn’t find cuda_runtime.h, although I changed $(CUDA_LIB_PATH) to $(CUDA_INC_PATH) in VS->projects->properties->CUDA->General->Additional include Directories.