I am trying to write some mex code but it is painful to debug it on the console with gbd. Is it possible to use Eclipse or the GUI of Matlab? If these are not feasible metho
Debugging C/C++ MEX files in gdb is already comprehensively covered in the official documentation, so my suggestion is to try and integrate gdb with Eclipse CDT.
There's plenty of information out there about how to do it properly, so I'm not going to repeat everything here. The best tutorial I know is IBM's two-part guide, "Interfacing with the CDT debugger":
I think part 2 is what you really need. Basically, you have to install a plug-in and configure it in Eclipse.
There are also quite a few related questions about this even here on StackOverflow:
I haven't tried it out yet, so I hope this works.
Here is my solution which works in Ubuntu 12.04, Matlab R2012b, and Eclipse IDE for C/C++ Developers Kepler Release.
On Windows platform:
The best way (to my experience) to debug a mex code is to use Visual studio.
Here's a link on how to do it.
Other platforms (Linux/Mac):
I'm afraid I haven't find any good way to do so apart from gdb (which is not fun at all).
Recently, Mathworks released a blog post describing how to use Visual Studio Code to debug mex code.
I haven't tried it myself, but it seems like a nice cross-platform solution for debugging mex files.