Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using argc and argv in 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?

like image 798
gamergirl22 Avatar asked Feb 14 '12 17:02

gamergirl22


People also ask

How do I see arguments in Eclipse?

When you place the cursor in a method's argument list, you will see a list of parameter hints. In the JDT editor, press Ctrl-Shift-Space, or select Edit→ Parameter Hints. A tool tip will appear, showing the method's parameters.

How do I debug command line arguments in Eclipse?

Right Click the class file -> Select "Debug As" -> Select "Arguments" Tab (provide the arguments)->Select "Apply" ->Select "Debug". Right Click the class file -> Select "Debug As" -> Select "Classpath" Tab "Select BootStrap Entries"-> Add JARs "Provide jar file location"-> "Apply" ->Select "Debug".

How do I pass a VM argument in eclipse?

-- Go to the Eclipse Window > preferences, in "Java > Installed JREs". -- Copy the current default JRE with a new name, for example myJRE. -- Select the new JRE and click on the "Edit" button. -- In the "Edit JRE" dialog, add your JVM arguments in the "Default VM Arguments" field.


1 Answers

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.

like image 121
Adrien BARRAL Avatar answered Sep 18 '22 18:09

Adrien BARRAL