WinGDB has an option to create a Visual Studio project and automatically add existing source files to it. The sources may reside on remote machine in case of remote Linux development scenarios, or local Windows machine for embedded or MinGW development scenarios. Use this option if you do not have a Visual Studio project yet.
For the rest of the tutorial, we assume that we want to import sources located on remote Linux machine in /home/user/build/cptest directory. The /home/user directory is shared and mapped to the U: drive. This is one of the possible scenarios. WinGDB can also use SCP file transfer to synchronize directories, or sources built locally. Some options for these scenarios will be different than those shown below. For the most part however, the procedure is the same.
In order to create a project from existing sources, click New Project... option in Visual Studio and choose the Import project from existing sources template from standard WinGDB templates.
In the Location field, you have to enter the parent directory of your project on U: drive, where it is mapped. This directory is named U:\build. In the Name field, specify the directory name of your project (cptest). This way, Visual Studio will create the project in U:\build\cptest, which corresponds to /home/user/build/cptest on the remote machine.
In case you do not have a Samba mapping or your sources are built locally, you do not need to specify a directory matching your sources location. WinGDB will copy the sources to the destination directory in such scenarios.
For the remote Linux with Samba share scenario that we are considering, please click OK and choose the Linux platform on the following screen:
For simplicity, we also assume that the program will be built and debugged on single Linux machine. Please choose appropriate scenario on the next screen:
On the next page, specify credentials needed to login on the remote machine:
Next, you can configure custom path to GDB. Usually leaving the default setting is sufficient:
The next page specifies how the sources are mapped from the remote machine to the local one. Select the variant with Samba sharing:
The next screen contains important settings for actual import:
When importing existing sources, WinGDB assumes that you already have some means to build them (e.g. a makefile) and does not generate its own makefile. Instead, you just specify how to launch the build process on this page:
You specify commands for building, rebulding and cleaning the project. By default, WinGDB supplies commands suitable for make. Also you can specify the Build working directory in which the build commands will be run and the output directory and name of resulting executable file. The latter will be used for debugging.
When the import is complete, you can optionally configure the makefile generator in Update mode to automatically add source files to your makefile. This section describes the procedure.
Next two pages allows you to set additional options for debugging. These options are basic and self-explanatory. Usually you just want to leave these fields empty.
This page displays the summary of properties set by the wizard. When you click Finish, the actuall importing process will begin. WinGDB will transfer the files (if necessary) and add them into project. It may take a while, depending on project size.
There are several possible scenarios of import, with regard to the sources location.