Using Visual Studio to debug Cygwin applications

This tutorial shows how to create, build and debug cygwin-based applications with Visual Studio.

Before you begin, please install cygwin and VisualGDB .

  1. Start Visual Studio. Select File->New project->VisualGDB->MinGW/Cygwin Project Wizard01-newprjSelect project location and enter a project name. Then click ‘OK’.
  2. Make sure that “Create a new project” is selected and click on ‘Next’.03-newprj
  3. On the toolchain page select “Cygwin”. VisualGDB will detect its location automatically or you can also select the installation directory manually. Click on ‘Finish’.04-cygwin
  4. The wizard will generate a Visual Studio project for a simple “Hello, World” application built with cygwin tools. To build it just select Build->Build Solution or press Ctrl+Shift+B.08-build
  5. Set a breakpoint on the cout line and start debugging by selecting Debug->Start Debugging or pressing F5. Debugging your cygwin-based app with VisualGDB is not much different from debugging normal Windows applications: stepping, watch windows, call stack, memory view and many other features will work as usual. VisualGDB will seamlessly control the GDB debugger on behalf of Visual Studio. You can also enter GDB commands directly in the GDB Session window.10-debugTo end debugging, press Shift+F5.
  6. You can always customize the properties of your project by right-clicking at it in Solution Explorer and selecting “VisualGDB Project Properties”.11-props
  7. From the properties window you can control build and debug command lines and many advanced parameters.12-settings