# Compiling for debugging does not work

**URL:** <https://forums.developer.nvidia.com/t/compiling-for-debugging-does-not-work/9490>\
**Category:** CUDA Programming and Performance\
**Created:** [May 14, 2009, 4:02pm UTC](https://forums.developer.nvidia.com/t/compiling-for-debugging-does-not-work/9490 "2009-05-14T16:02:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rocksportrocker](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@rocksportrocker](https://forums.developer.nvidia.com/u/rocksportrocker)\
**Post date:** [May 14, 2009, 4:02pm UTC](https://forums.developer.nvidia.com/t/compiling-for-debugging-does-not-work/9490/1 "2009-05-14T16:02:07Z")

</div>

Hi, In order to learn using cuda-gdb I tried to compile one example from the SDK with switch “-G0”

and got problems as follows:

> [@](#):
>
> g++ -W -Wall -Wimplicit -Wswitch -Wformat -Wchar-subscripts -Wparentheses -Wmultichar -Wtrigraphs -Wpointer-arith -Wcast-align -Wreturn-type -Wno-unused-function -I. -I/usr/local/cuda/include -I…/…/common/inc -DUNIX -g -o obj/debug/recursiveGaussian.cpp.o -c recursiveGaussian.cpp
> 
> recursiveGaussian.cpp:96: warning: deprecated conversion from string constant to Ã¢â‚¬Ëœchar\*Ã¢â‚¬â„¢
> 
> recursiveGaussian.cpp:234: warning: unused parameter Ã¢â‚¬ËœxÃ¢â‚¬â„¢
> 
> recursiveGaussian.cpp:234: warning: unused parameter Ã¢â‚¬ËœyÃ¢â‚¬â„¢
> 
> recursiveGaussian.cpp:400: warning: unused parameter Ã¢â‚¬ËœargcÃ¢â‚¬â„¢
> 
> recursiveGaussian.cpp:400: warning: unused parameter Ã¢â‚¬ËœargvÃ¢â‚¬â„¢
> 
> /usr/local/cuda/bin/nvcc -D\_DEBUG -G0 -I. -I/usr/local/cuda/include -I…/…/common/inc -DUNIX -g -o obj/debug/recursiveGaussian.cu.o -c recursiveGaussian.cu
> 
> g++ -fPIC -o …/…/bin/linux/debug/recursiveGaussian obj/debug/recursiveGaussian.cpp.o obj/debug/recursiveGaussian.cu.o -L/usr/local/cuda/lib -L…/…/lib -L…/…/common/lib/linux -lcudart -lGL -lGLU -lX11 -lXi -lXmu -lGLEW -L/usr/X11R6/lib -lglut -lrendercheckglD -L/usr/local/cuda/lib -L…/…/lib -L…/…/common/lib/linux -lcutilD
> 
> obj/debug/recursiveGaussian.cu.o: In function `$$SymbolTable’:
> 
> (.nv11Segment+0xd70): undefined reference to `$gpu\_registers’
> 
> obj/debug/recursiveGaussian.cu.o: In function `$$SymbolTable’:
> 
> (.nv11Segment+0x1ab4): undefined reference to `blockDim’
> 
> obj/debug/recursiveGaussian.cu.o: In function `$$SymbolTable’:
> 
> (.nv11Segment+0x1ac0): undefined reference to `gridDim’
> 
> obj/debug/recursiveGaussian.cu.o: In function `$$SymbolTable’:
> 
> (.nv11Segment+0x1acc): undefined reference to `blockIdx’
> 
> obj/debug/recursiveGaussian.cu.o: In function `$$SymbolTable’:
> 
> (.nv11Segment+0x1ad8): undefined reference to `threadIdx’
> 
> collect2: ld returned 1 exit status

I’m using Ubuntu 8.04 and Cuda 2.2.

Any hints ?

Uwe

---

<div class="post-metadata">

**Author:** ![tmurray](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@tmurray](https://forums.developer.nvidia.com/u/tmurray)\
**Post date:** [May 14, 2009, 4:09pm UTC](https://forums.developer.nvidia.com/t/compiling-for-debugging-does-not-work/9490/2 "2009-05-14T16:09:38Z")

</div>

You have to use nvcc to perform the link step at the same time you perform all compilation for debugging .cu files.
