开发者

how to let eclipse cdt show runtime error (e.g. segmentation fault)

I develop and 开发者_运维问答run C++ program in Eclipse CDT on Linux.

The problem is that Eclipse CDT does't show any runtime error message (e.g. segmentation fault) in console, while I can get such error message when running program directly with command line.


Hello
You could try to modify the run configuration like this

  • tab 'Main' > Application = /bin/sh
  • tab 'Arguments' > 'Program arguments' = -c "Debug/name_of_executable arg0 arg1 ... 2> /dev/stdout"

(replace "arg0 arg1 ..." with your program arguments, if any)
The eclipse console will output both stdout, stderr and the segmentation fault message (prefixed with "/bin/sh: line 1 ...")
note : I used this solution on an older release of eclipse for which the symptoms are the same.


I would recommend that you use the debugger instead of just running the executable!

I had the same problem when trying to import an existing c++ solution into CDT. I found it a bit odd that Eclipse didn't report anything in case of an segmentation fault. If you use the debugger, it will notify you of the segmentation faults and point you to the correct place in the code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜