saulspatz
saulspatz

Reputation: 5261

How to Pass Command-Line Arguments in Xcode

I'm trying to pass arguments to my Xcode C++ command-line tool. I think I'm following the help, and the answers I've found on Stack Overflow, but I'm not having any luck.

I'm using Xcode 7.2.1. I've edited the scheme to have two command-line arguments (an input file and an output file.) I've posted a screen shot of the editor below.

When I run the code, it doesn't find the arguments. (I don't mean that it can't find the files on disk. The program aborts because argc is 1 instead of 3.)

Can you tell me what I'm doing wrong?

EDIT: After playing around with it in response to the advice I received, it suddenly worked. I have no idea what changed. It works now with the dialog looking exactly like the screenshot I posted originally.

enter image description here

Upvotes: 4

Views: 9870

Answers (1)

Logicrat
Logicrat

Reputation: 4468

I'd suggest that you use only one argument set at a time. Each one of the checked lines represents a command line, not a single argument, so put both of your arguments on a single line, as in

$PROJECT_DIR/detroit.txt $PROJECT_DIR/detroit.out

Upvotes: 1

Related Questions