views:

145

answers:

1

Hello,

I'm learning C++ and using VS C++ 2008 Express.

I have a simple project with 2 code files. One is for my Class and the other is "_tmain()". My class file is using: template <typename T> code.

The program seems to run fine, but I can't step into my class file code in c++ view. I have to look at the assembly code.

I can step into _tmain() just fine, but when I try F11 to step into my class methods, there is "no source code available".

Any ideas on this one?

Thanks, M3NTA7

+3  A: 

Maybe you just forgot to active debug information (happens if you create an empty project).
This can (at least in VS2005) be activated via the Projects Properties -> Configuration Properties -> Linker -> Generate Debug Info.

Georg Fritzsche
Thanks, I just looked and I've got Debug info set to YES and I can set break points in 'main()' but when I try to step into from one of those lines into my Class is where I can only view assembly.
M3NTA7
Do you have the .pdb in the same directory? Have you verified you are debugging the current build?
Georg Fritzsche
You say you have debug info set to yes, but are you actually compiling in Debug configuration (i.e. with optimizations disabled)? Class template methods are typically all `inline`, and are likely to be aggressively inlined when you compile with optimizations.
Pavel Minaev
Thanks Pavel, That was it. I disabled the optimizations and then I could break into my C++ code.
M3NTA7