Debugging skips over breakpoints

Using C++ .NET 2003 and getting:

"The breakpoint will not currently be hit. No executable code is associated with this line."

My app links to my static library and when I try debugging either one, I can't debug any code from the library it calls, although I can debug the main app.  It skips over the breakpoint even if I try setting it after starting the debugger.  This is true if I set the breakpoint by function name or line number.

My configuration manager is set to debug (not release).  /ZI is being used for compile flags.  I've tried deleting my library then rebuilding to verify that it's using the correct one.  

Thanks for any help!
winwardAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

guitaristxCommented:
It's a tricky thing debugging library code.  I would recommend opening the project that compiles the library, and debug the library - you'll have to point it to the app's .exe file.
winwardAuthor Commented:
Thanks for the suggestion.  When I do this though, I still have the same problem.  I can debug the code from my main app but it skips over breakpoints I set in the library.  Before debugging, the breakpoints appear as solid red dots.  Once I start debugging, they appear as question marks.
nonubikCommented:
>Before debugging, the breakpoints appear as solid red dots.  Once I start debugging, they appear as question marks.
This means that the source code you're trying to debug is not associated with the binary file (static lib) that the debugger runs. This may occur if: you're linking with a .lib located somwhere else than the output of the debugged source code, .pdb file missing or corrupted, etc.

If you have both the app and the library in the same VC++ solution, you can try this: set the library as the active project, set in the project properties under the 'Debugging' section, your app in the 'Command line' field. So you'll be debugging the library with your app as executable.
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

guitaristxCommented:
nonubik is correct - you must debug with the library's project set as the "active" project.  Don't debug the _app_, debug the _library_.  If you get a dialog asking for an executable file, you're on the right track =)
winwardAuthor Commented:
Still not working.  Previously, I was using 2 instances of C++ .NET so I created a solution with 2 projects - one for the library and one for the library.  I set the library as the startup project and selected it.  I assume that one of these actions makes the library "active".  Also, the library was listed as an item of the app's project.  I removed the library item and set the app to depend on the library project and set the library to be built first.

With the library selected, I pressed F10.  After specifying the executable, I immediately saw the app's source code.  I continued stepping over instructions until I got to the first call to the library.  When I tried stepping into this, it simply stepped over it.

I'm beginning to wonder if a DLL would be easier.  At least this way I would know that my symbols are being loaded and there are explicit instructions in the KB for a DLL.  Of course, maybe this wouldn't solve the problem.  I've never done this before so I'd prefer to just stick with the static library.
nonubikCommented:
Place breakpoints in the library source code. Start debugging with F5, not F10 (which is stet by step).
Your breakpoints should be active if the app links with your library that you're debugging.
winwardAuthor Commented:
My app is not linking to the library I'm debugging.  It may be because my library and app are located in 2 different directories.  Perhaps my project settings are incorrect.  Which files should be in which directories? Or how can I set the project settings for the library and the app so that the app links to the library I'm debugging? Thanks.
nonubikCommented:
To link your app with the library you want to debug, make sure the .lib you link against is from the library's output folder.
I suppose you have added in your app project settings, in the 'Additional dependencies' field the 'library.lib'. To make sure it's from the right folder, type the path to it in Linker->General->Additional Library Directories

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
winwardAuthor Commented:
I haven't had a chance to try this yet.  Because of my earlier troubles and time constraints, I just merged the two projects and debugged.  This was effective but not the solution I wanted.  Anyway, I'll give nonubik the points for all of his help, and I when I do try again (whenever that may be???), I hope it will work :-) Thanks for all your input.
nonubikCommented:
10x anyway :o)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual C++.NET

From novice to tech pro — start learning today.