0

I'm trying to send two arguments to Xcode through terminal. I've watched some tutorials that had the following steps:

  1. Change the directory by typing cd followed by the path of the folder containing the program files.
  2. gcc main.c -o randomProgramName
  3. ./prog argument1 argument2

My file is a .m file, but replacing the .c the examples uses with a .m doesn't work. I feel like I'm way off. I also installed the command line tools, hoping it would work, but no dice.

Brosef
  • 2,945
  • 6
  • 34
  • 69
  • 1
    Do you want to send arguments to a program you're writing **with Xcode**, or are you trying to send arguments to **Xcode itself**? – Tyler Eich Nov 03 '13 at 01:14
  • @TylerEich to a program i'm writing with xcode. In the example, terminal should display the result of the program after inputting the arguments. – Brosef Nov 03 '13 at 01:22
  • 1
    if you choose Edit Scheme for your running scheme, there's a tab for arguments. You can add them there if you want to pass an argument to your program. – GW.Rodriguez Nov 03 '13 at 07:37
  • @GW.Rodriguez ya that i'm able to do. Just trying to learn the steps to do it through terminal. – Brosef Nov 04 '13 at 20:21

1 Answers1

1

If you're running a program in Xcode and want to send arguments to it, there's a StackOverflow question to help you out.

If you want to send arguments to a compiled Objective-C program in Terminal, here's another StackOverflow question to help with that.

Community
  • 1
  • 1
Tyler Eich
  • 4,239
  • 3
  • 21
  • 45
  • I came across that same question, which does the same thing. But I'd like to learn how to do it through terminal. – Brosef Nov 04 '13 at 20:21
  • @Brosef — So you want to build a program with Xcode, then send arguments to that compiled program from Terminal? Just like you send arguments to any other command line program? – Tyler Eich Nov 04 '13 at 20:46
  • ya command line arguments. Like they do in this video http://youtu.be/eSVLr5lI-es?t=11m43s (@11:45) except for a .m file. – Brosef Nov 05 '13 at 22:29
  • Edited my answer to include both approaches. – Tyler Eich Nov 05 '13 at 23:41