# CUDA debugging on VS2005 Need help...

**URL:** <https://forums.developer.nvidia.com/t/cuda-debugging-on-vs2005-need-help/4901>\
**Category:** CUDA Programming and Performance\
**Created:** [August 6, 2008, 4:30am UTC](https://forums.developer.nvidia.com/t/cuda-debugging-on-vs2005-need-help/4901 "2008-08-06T04:30:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sunafets](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@sunafets](https://forums.developer.nvidia.com/u/sunafets)\
**Post date:** [August 6, 2008, 4:30am UTC](https://forums.developer.nvidia.com/t/cuda-debugging-on-vs2005-need-help/4901/1 "2008-08-06T04:30:40Z")

</div>

Hello,

I need some help on debugging CUDA codes using my VS2005. I have done all of the following:

1. Install CUDA build rule made by Jared ([http://forums.nvidia.com/index.php?showtopic=30273](http://forums.nvidia.com/index.php?showtopic=30273)) and enable it for my project.
2. Set the /DEBUG linker option (to generate debug info).
3. Compile the project in EmuDebug build by enabling Emulation on the CUDA property page.

The project compiles and runs, but when I set a breakpoint inside a .cu file, the breakpoint doesn’t seem to correspond to the line of code specified (e.g. it continues even when it encounters a return statement, it skips codes that are not inside a conditional block, etc.). Further, I also can’t view the variables’ values in the watch window (it says the symbol ‘variableName’ is not found). Could someone help me on this? Thanks!

---

<div class="post-metadata">

**Author:** ![sunafets](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@sunafets](https://forums.developer.nvidia.com/u/sunafets)\
**Post date:** [August 6, 2008, 8:39am UTC](https://forums.developer.nvidia.com/t/cuda-debugging-on-vs2005-need-help/4901/2 "2008-08-06T08:39:21Z")

</div>

OK, finally managed to solve the problem:

- The inaccurate breakpoint was because I split long CUDA\_SAFE\_CALL() line to several lines. Apparently, multiple line-CUDA\_SAFE\_CALL()s (and other macros, I suspect) are still counted as one line by nvcc preprocessor…
- Symbol not found: the debugger couldn’t find variables put inside an anonymous namespace. Declaring these variables as static solves the problem.
