C++ NetBeans 运行配置传递参数问题
当我想从 IDE 中运行带有参数的程序时,我会这样做: ProjectProperties→Run→Arguments并在其中输入我的参数。
但如果我想调试,NetBeans 会忽略那里给出的这些参数。
那么如何使用给定的命令行参数调试项目呢?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我遇到了同样的问题..我的 NetBeans C 项目在调试模式下不采用命令行参数..,但仅在运行 (F6) 时采用..
..
我所做的(NetBeans/MinGW):
卸载 mingw-get
运行 mingw-get-inst-20100909.exe(其中有 gdb 7.1)。
http:// sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/mingw-get-inst/mingw-get-inst-20100909/
这是一个临时解决方案,直到二进制 NetBeans 6.9.2 版本可用为止。
希望这可以帮助某人..
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..
我在
Netbeans 6.9
上遇到了同样的问题,但在6.8
上没有遇到同样的问题,并发现解决方案是更新Netbeans
。http://forums.netbeans.org/topic36082.html
I had the same issue with
Netbeans 6.9
but not6.8
, and found that the solution was to updateNetbeans
.http://forums.netbeans.org/topic36082.html
我有同样的问题,有一种方法可以解决它。
首先,您需要在 NetBeans 中启用 GDB 控制台,方法是在 NetBeans 配置文件中设置此选项(您必须关闭 NetBeans 才能使其工作)
-J-Dgdb.console.window=true
接下来,在 NetBeans 上,然后开始之前在您的程序中,在 main() 的开头设置一个断点。一旦执行在那里中断,请使用“set args [arguments]”gdb 命令,然后使用“run”重新启动已调试的程序,现在已设置参数。
重建项目时不需要关闭调试会话,因为 GDB 会检测到它并在您再次发出“运行”命令时重新加载新的二进制文件;这样您就不必再次设置参数。
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.