It's not entirely clear what you're asking, so I'll explain the differences and give two methods:
Debugging refers specifically to running your program in a debugger, which can catch run-time errors, and which allows you to stop your program at any point and inspect the variables and the call stack while the program is running.
The "build" button that you refer to sounds like it compiles your program and reports any errors; these are compile errors and happen before you can run your program.
It sounds like you're used to use an IDE (Integrated Development Environment) that hides these details from you. ROS, and general software development on Linux, does not try to hide this process.
To build your ROS program, you must first tell the system which files you want to build by writing the CMakeLists.txt file (examples are covered in the tutorials). You then build your program with the catkin_make
command.
To run, you use rosrun. You can use the --prefix
option to rosrun to run your program in a debugger such as gdb, or in a memory check program such as valgrind.
There are also a number of IDEs that have some integration with ROS, but they may not provide all of the features you expect: http://wiki.ros.org/IDEs (I haven't tried any of them, but I know other people like them).