C/C++ Tools & Methodology demonstration He Zongjian School of Software Engineering Tongji University
Agenda Project management in Visual Studio Develop Resource lookup Debugging with Visual Studio Introduction to Windows GUI Apps Sample application of C++ project References Discussion
Project management in Visual Studio
Common Bad Habit Create a *.c / *.cpp file Open it with Visual Studio Compile
Bad Effect NO Intelligent Sense Class View / File View disabled Can NOT debugging Can NOT locate definitions An Expensive Notepad
What is Workspace & Project Configuration files that help us managing the project A workspace can have multiple project Workspaces have the.dsw extension Projects have the.dsp extension Double click the workspace can auto launch the Developer studio
Other files used by devenv .ncb : Visual C++ IntelliSense Database .rc : Resource template .pch : Precompiled header .obj : Intermediate file .pdb : Program debugging database .bsc : Browse information .clw : Class wizard file (MFC only)
Using File View & Class View File View : –Add new file –Delete file Class View : –Locate functions & variables –Add new class –Add member functions and member variables
Project configuration Debug version VS Release Version Enable RTTI Command line arguments
Useful Tips Code auto formatting (Alt + F8) Go to definition Go to reference Find in files Open document
New features in VS.NET .dsw ->.sln Integrated IDE Measure up to C++ standard ……
Develop Resource lookup
Microsoft Developer Network (MSDN) All develop related resources Online Version: – –Released every 4 months Visual Studio 6.0 Version (.chm) –VB 6, VC 6, VFP 6, VJ 6, VID 6, Platform SDK After Jan 2002, Visual Studio.NET Version –.NET framework
Demo : How to use MSDN
Other Resources Knowledge Base – TechNet – Developer Works (IBM) –
Debugging with Visual Studio
What is debugging? A process for identifying the root cause of a problem by tracing program execution flow and underneath memory status. Beneficial after performing general troubleshooting steps.
Basic debugging knowledge Symbols : The PDB files generated with your binaries by VS Debugging tools –Visual Studio –Windbg / CDB ( For Windows ) –Debug ( For MS-DOS ) –Gdb ( For Linux / Unix / AIX )
Common Debug Scenario Logic Error Memory Leak Access Violation (AV)
Basic Methodology Set break point Step into / Step over / Step out Variables monitor (Local / Watch / Auto) Call stack Memory Register Disassembly
Demo : How to use Visual Studio.NET to debugging
Advanced Methodology Conditional Breakpoint Remote debugging (GDI / Kernel) JIT debugging Debugging running process Debugging crash dump Multithread debugging
Demo : Conditional Breakpoint Attach to a process
Solving Access Violation Buffer Overflow / Underflow –Heap Corruption –Stack Corruption Memory Access Denied –Raw Pointer –Double Free
The Hint Debuggers are just tools We must also : –Know the product –Know the languages and their implications (compiler implementation) –Know the operating system –Know the CPU –Know the tools
Introduction to Windows GUI Applications
What does GUI App Contains Entry Point : WinMain Register a window class Create and Show a Window Message Loops Windows Procedure (WinProc) Resource Template
Demo : Create and analyze a GUI application
Sample application of C++ project
Demo : Text Miner 1.0 Cheat Killer 0.02 Demo : Text Miner 1.0 Cheat Killer 0.02
References
C / C++ references Thinking in C++ 2nd Edition Bruce Eckel C++ Primer Stanley B.Lippman The C++ Programming Language 3rd Edition Bjarne Stroustrup
C / C++ references (Cont’d) The C++ Standard Library 侯捷 译 STL 源代码剖析 侯捷 著 The C++ template David Vandevoorde Inside C++ Object Model Stanley B.Lippman
GUI Programming Programming Windows 4 th Edition Charles Petzold MFC Windows 程序设计 2 nd Edition Jeff Prosise Programming Microsoft Visual C++ David J. Kruglinski
Debugging References Debugging Application John Robbins Debugging Applications for Microsoft.NET and Microsoft Windows John Robbins Debugging Windows Programs Everett N. McKay
Discussion
© 2003 Tongji University. All rights reserved. This presentation is for informational purposes only. TJSSE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY. Thanks! Question?