Debugging is currently not working in GMAT's main Visual Studio build system (
build/windows-VS2010/GmatVS2010.sln). We have postponed investigation of this pending our upcoming build system rewrite using CMake, scheduled for later this year (2013). However, if you have any ideas, or a fix, please let us know.
See the GMAT Forum for discussion of this issue.
In the meantime, we have a separate static debug solution that works for interactive debugging:
(1) The README file specifies the need to define the WXWIN environment variable, to point to the location of your wxWidgets installation. However, the README does not tell you that you ALSO have to define two additional environment variables, CSPICE_VC32 and MATLAB32. Those environment variables are referenced in the debug configuration when you open VC-GMAT.sln. If you don't define them you'll get all sorts of errors, most of the cspice errors. Defining
CSPICE_VC32 --> should point to the location of Gmat3rdParty\cspice
MATLAB32 --> should point to your local 32-bit installation of MATLAB
takes care of a lot of the initial reference errors during the build process. Note that after you define those environment variables in Windows you may need to log out and log back in in order for the system to register the changes. Best to do it just to be safe.
(2) The VC-GMAT.sln file assumes that wxWidgets was compiled using the Release configuration, not Release DLL and not Debug or Debug DLL. I can tell because the config file is looking for the libraries in the lib\vc_lib folder of WXWIN. So, if you had previously built wxWidgets using anything other than the Release configuration, you'll need to rebuild using the appropriate one.
(3) You will need to implement the change Chad pointed out above. To do this, in the Debug configuration of VC-GMAT.sln,
change Configuration Properties --> C/C++--> Code Generation --> Runtime Library --> Multi-threaded (/MT) to Multi-threaded DLL (/MD). That will get rid of missing symbol errors.
(4) Now, go to Configuration Properties --> Linker --> Input --> Ignore Specific Default Libraries and added "LIBCMT.lib" to the list and made sure that "Ignore All Default Libraries" was set to NO otherwise. That got rid of some errors about conflicts between that and MSVCRT.lib.
(5) Copy gmat_startup.txt to build\windows\Debug, edit out any references to PLUGIN folders, and write in the FULL path to the GmatDevelopment\application folder under ROOT_PATH. When GMAT starts, it looks for files under the data folder in this path. If you try to execute GMAT in debug mode, stepping through, without doing this you'll get errors about missing textures.
These five changes should allow you to build GMAT in Debug mode, while linking to a non-debug version of wxWidgets. If you want to build wxWidgets in debug mode, and link GMAT to those, you could. If you feel the need to do that, you would need to edit the VC-GMAT.sln file to include the _DEBUG preprocessor directive. This would be under Configuration Properties --> C/C++ --> Preprocessor. Then, you'd also append a "d" accordingly to all the wx libraries included (e.g. wxbase28d.lib instead of wxbase28.lib). These are listed under Configuration Properties --> Linker --> Additional Dependencies.
It is worth noting that this VC-GMAT.sln file is out-of-date in relation to the latest GMAT trunk. So, the default build does not include ALL the cpp and hpp files in the GMAT trunk. I tried adding all, but it seemed to cause problems so I reverted to the original version of the GMAT project file in the VS2010 solution. I may try again later.
In the case of GmatConsole, the opposite problem exists. Files that previously existed within the tree are no longer there. So, attempting to build GmatConsole with build\windows\VC-GMAT.sln will give the following errors:
I manually removed them to get rid of the error but that didn't end the problems.
Hope that helps someone, somewhere. The changes affect build\windows\VC-wxGUI\VC-wxGUI.vcxproj. I have attached the modified version.