Using argc and argv in Eclipse?

拥有回忆 提交于 2019-12-04 22:59:09

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/9280992/using-argc-and-argv-in-eclipse

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