在 Eclipse 中使用 argc 和 argv?

发布于 2025-01-06 06:50:35 字数 156 浏览 3 评论 0原文

我有一个工作程序,但现在我必须对 main 使用 int argcchar *argv[] 参数。每当我尝试这样做时,它都会给我带来无法保存的错误。有没有办法让 argc 和 argv 在 Eclipse 中工作?

I have a working program but now I have to use the int argc and char *argv[] parameters to main. Whenever I try to do this it gives me errors that it cannot save. Is there any way to make argc and argv work in Eclipse?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

鱼窥荷 2025-01-13 06:50:35

我猜你的问题是,当你通过 eclipse 执行它时,你不知道如何将参数传递给你的程序,不是吗?

如果这就是您想要的,请阅读以下内容。

单击“项目->属性”,然后在“运行/调试设置”中单击“新建按钮”。选择 C++ 应用程序。这里你可以看到有4个选项卡,第二个选项卡称为“arguments”。
在此选项卡中,您可以看到一个文本区域。在那里输入您的应用程序的参数,然后单击“确定”。
当您通过 Eclipse 的“播放”按钮执行应用程序时,您的程序将被带参数调用。

I guess your problem is that you don't know hot to pass argument to you program, when you execute it through eclipse isn't it ?

If that is what you want, read the following.

Click on the "Project->Properties" then in "Run/Debug settings" click on the "New button". Choose C++ application. Here you can see that there are 4 tabs, and the second tab is called "arguments".
In this tab you can see a textarea. Type your application's argument there, and click "OK".
When you will execute your application thanks to the "play" button of eclipse, your program will be called with arguments.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文