Debugging a lib.

Started by
2 comments, last by Sneftel 13 years, 6 months ago
The only way I know to test and debug a lib is by putting the source files into an exe project. I have to test each function in the lib then to compile it I have to copy the source files to a lib project and compile it.

Is there another way to do it?
Advertisement
If there's an application built with the lib, you can specify that application to be run for debugging purposes.

Or, you can run that application and then manually attach the debugger to it.

Or, if the LIB and the PDB are kept together, and you don't move your source files around, you can step into the functions from the library while debugging any application which links it.

Or, if the LIB project and the application which uses it are in the same solution and the application has the LIB as a dependency, all that stuff will just happen automatically.

Or, you can create a special test harness for the LIB to test it.
Quote:Original post by Sneftel
If there's an application built with the lib, you can specify that application to be run for debugging purposes.

Or, you can run that application and then manually attach the debugger to it.

Or, if the LIB and the PDB are kept together, and you don't move your source files around, you can step into the functions from the library while debugging any application which links it.

Or, if the LIB project and the application which uses it are in the same solution and the application has the LIB as a dependency, all that stuff will just happen automatically.

Or, you can create a special test harness for the LIB to test it.


What is this "test harness" you speak of?
Visual Studio's built-in unit testing framework isn't suitable for use with unmanaged C++, but there are other unit testing frameworks which you can use. I've heard good things about VisualAssert (well, I've heard good things about cfix, on which VisualAssert is based), though I personally haven't used it.

This topic is closed to new replies.

Advertisement