You’re using Eclipse to develop a C/C++ Windows command line application, and instead of debugging using the Eclipse integrated console you would like to use a native DOS/Windows console. Some reasons to do so are that the Eclipse integrated console doesn’t deal very well with some DOS console features (like cursor positioning), and it may buffer some inputs. Happily, it is possible to configure Eclipse to use a native console !
The following steps describe in details the procedure to follow. Else, you can download from here a sample “HelloWorld” Eclipse C++ project which is configured to use an external DOS console for debug.
- Create your Hello World C++ command line project, from the Eclipse menu File > New > C++ Project :
- In your project folder, create a “.gdbinit” text file. It will contain your gdb debugger configuration
- Edit “.gdbinit”, and add the line (without the quotes) : “set new-console on”
(or download the file from here) - In Eclipse, go to menu Run > “Debug Configurations”, and select your application name in the left pane :
- In the “debugger” tab, ensure the “GDB command file” now points to your “.gdbinit” file. Else, input the path to your “.gdbinit” configuration file :
- Click “Apply” and “Debug”. You’re done ! A native DOS command line should be launched.
After searching a lot found your blog ……… saved my week……….
Thanks buddy thanks a lot………….
My pleasure 🙂 I also wasted a lot of time on this before finding how to do it.
Really good Post Worked like a charm……
Please do me one more favor and i’ll be in your debt. While I am running the debugger output is coming fine in the cmd console but the variable values showing in hexadecimal format in eclipse panel instead of decimal… and in the native console of eclipse showing the errors i pasted below.
I guess this has to do something with the .gdbinit file….. may be the file i am using is not appropriate… yes the .gdbinit file link is broken i had to download it from other sources.
Any idea what i am missing…………
Whatever it is… Thanks Again…… You stopped my continuous search of 2 weeks…
—————————————————- CONSOLE OUTPUT——————————————————————
The target endianness is set automatically (currently little endian)
[New Thread 4308.0x15ec]
[34m———————————————————————————————————————–[34m[1m[regs]
[0m [32mRAX:[0m 0xError while running hook_stop:
Value can’t be converted to integer.
[34mError while running hook_stop:
Value can’t be converted to integer.
———————————————————————————————————————–[34m[1m[regs]
[0m [32mRAX:[0m 0x[34mError while running hook_stop:
Value can’t be converted to integer.
———————————————————————————————————————–[34m[1m[regs]
[0m [32mRAX:[0m 0x[34m———————————————————————————————————————–[34m[1m[regs]
Error while running hook_stop:
Value can’t be converted to integer.
[0m [32mRAX:[0m 0x[34m———————————————————————————————————————–[34m[1m[regs]
[0m [32mRAX:[0m 0xError while running hook_stop:
Value can’t be converted to integer.
Error while running hook_stop:
Value can’t be converted to integer.
[34m———————————————————————————————————————–[34m[1m[regs]
[0m [32mRAX:[0m 0xError while running hook_stop:
Value can’t be converted to integer.
[34m———————————————————————————————————————–[34m[1m[regs]
[0m [32mRAX:[0m 0x[34m———————————————————————————————————————–[34m[1m[regs]
[0m [32mRAX:[0mError while running hook_stop:
Value can’t be converted to integer.
0x[34m———————————————————————————————————————–[34m[1m[regs]
Sorry Symor, never saw this error before, and I don’t know what may be causing it.
Thanks for notifying me about the broken links, I fixed them.
Oh thx u a lot man, saved meh.
Glad it helped you !
Hi,
Thank you for your helpful post. I need to do the same thing but under Linux. Can you give me a hint on that? I tried this in my Ubuntu 12.04 OS, but doesn’t seem to be working!
Hi Sep,
Sorry, but I won’t be able to help you with that, I’m not familiar enough with linux development. Good luck !