Windows Debugging with Visual C/C++ (VS)

  1. Edit the compile_mex.bat and set the paths of your GMT, NETCDF and GDAL installations.
  2. Run the compile_mex.bat, which will create these two files: gmtmex.mexw64 and a gmtmex.pdb
  3. Put those files somewhere under the MATLAB path, and remember that the GMT bin dir must on the Windows path as well so that the dependencies may be found by MATLAB.
  4. To debug: in VS connect the MATLAB process via "Tools → Attach to process..". You are now ready to debug. In VS load the gmt-mex\trunk\src\gmtmex.c code and set breakpoints. When you run the gmt MEX from MATLAB it will stop at the breakpoints.