How do I properly pass command line arguments to a C program in CLion?
Asked Answered
N

4

15

I need someone to outline how to pass command line arguments to CLion. What I've found so far hasn't worked for me. Specifically I need to know how to pass multiple arguments to the program from the command line.

Neurath answered 10/2, 2016 at 14:34 Comment(1)
Have you seen this?Aminaamine
F
17

If you click on Run-Edit Configurations you can create an "Application" configuration that allows you to provide the Program arguments - either in a single line, or in a separate window one argument per line.

Filiano answered 10/2, 2016 at 14:38 Comment(0)
K
9

I landed on this SO page as I was using CLion with Rust.

For Rust I was able to add the command line arguments to the end of the Run\Edit Configurations\Command. Notice the required --.

clion config for rust

I got this tip from Jetbrains.

For C, it was Run\Edit Configurations\Program Arguments, as @Zulan said.

Keyes answered 24/5, 2021 at 8:3 Comment(2)
Thank you, took me a while to find this post.Hescock
so, the program arguments == command line arguments, because in latest version I can only see that.Parameter
M
0

It is on the Run Menu, Edit Configurations Option. Provide the various program arguments on the "Program Arguments" input field

Clion Edit Configurations

Mendicant answered 15/2, 2024 at 7:5 Comment(0)
B
0

Apologies that I am not as good as others with graphics.

Updated answer for 2024.1.1 with CLion:

On the Main Toolbar, just to the right of the Debug run symbol (the bug), there are three vertical dots for additional items. Left click here to open the menu that the first answer speaks about. At the bottom of the popup menu is Configuration with Edit or Delete. Choose Edit and it will open a window to set the command line arguments for your app during debug.

Bisk answered 26/5, 2024 at 21:35 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.