Visual Studio nvcc wrapper

The attached Perl script converts the error messages produced by nvcc into a format parsable by MS Visual Studio. This enables you to double click on compiler errors to jump to the appropriate line, which is more convenient than pressing Ctrl-G and typing in the line number!

Copy the attached script to your “c:\CUDA\bin” directory, renaming it “nvcc_wrapper.pl”.

You need a recent version of Perl installed, for example:
[url=“Download & Install Perl - ActiveState”]http://www.activestate.com/Products/activeperl/[/url]

Then in your custom build steps, just replace “nvcc.exe” with “nvcc_wrapper.pl”. You also need to escape any quotes you have in the command line to stop them being expanded, e.g.:

“$(CUDA_BIN_PATH)\nvcc_wrapper.pl” -ccbin "$(VCInstallDir)bin" -c -DWIN32 -D_CONSOLE -D_MBCS -Xcompiler /EHsc,/W3,/nologo,/Wp64,/O2,/Zi,/MT -I"$(CUDA_INC_PATH)" -I./ -I…/…/common/inc -o $(ConfigurationName)$(InputName).obj $(InputFileName)

I’m posting this here as a convenience for Windows CUDA programmers, it’s not a supported product!

Thanks to Evan Hart for some additional fixes.
nvcc_wrapper.txt (1.62 KB)