C++ NetBeans Run-Configuration passing arguments-issue

孤者浪人 提交于 2020-01-05 03:35:23

问题


When i want to run a program with arguments out of the IDE i do this: ProjectProperties→Run→Arguments and type my arguments in there.

But if I want to Debug, NetBeans ignores these arguments given there.

So how can I debug a project with command-line-arguments given?


回答1:


I had the same issue.. My NetBeans C project don't take command line arguments in debug mode.., but only with run (F6).. .. What I've done (NetBeans/MinGW): uninstall mingw-get run mingw-get-inst-20100909.exe (this has gdb 7.1). http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/mingw-get-inst/mingw-get-inst-20100909/ This is a temporarry solution until binary NetBeans 6.9.2 release will be available.. Hope this help someone..




回答2:


I had the same issue with Netbeans 6.9 but not 6.8, and found that the solution was to update Netbeans.

http://forums.netbeans.org/topic36082.html




回答3:


I have the same issue, and there is a way to get around it.

First, you need to enable GDB console within NetBeans, by setting this options on your netbeans config file (you will have to close NetBeans for it to work)

-J-Dgdb.console.window=true

Next, on NetBeans and before you start your program, set a break point right at the start of your main(). Once execution breaks there, use the "set args [arguments]" gdb command followed by "run" to restart your debugged program, now with the arguments set.

You do not need to close the debug session when you rebuild your project, as GDB will detect it and reload the new binary when you issue the "run" command again; this way you wont have to set the arguments again.



来源:https://stackoverflow.com/questions/4353764/c-netbeans-run-configuration-passing-arguments-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!