-1

I am learning from The C++ Primer. One of the exercises is to compile a program with arguments in main(). For this I am trying to use mac terminal.

I need to compile a C++11 Unix executable file named main which takes f as an argument. I am using Xcode 4.6.3 on OS X Lion.

I compiled the program with clang++ -std=c++11 -stdlib=libc++ main.cpp -o main. But don’t know what to do next.

I found -frecord-gcc-switches while searching compiler options on google. It does what I need to do. Is there a clang version of this?

Please use simple language. I have never used command line before. I tried going through the clang manual but a lot of it is out of my depth.

Olivia Stork
  • 4,660
  • 5
  • 27
  • 40
Deohboeh
  • 37
  • 7

1 Answers1

1

If the compiler didn't complain about anything, you should have a fresh new file named main in the same directory as the source file, and you can run it from the command line using ./main -f or the like.

Potatoswatter
  • 134,909
  • 25
  • 265
  • 421
  • Thank you! It works! Are there any books on this that I can read? – Deohboeh Nov 04 '13 at 09:12
  • 1
    @Deohboeh I suppose you just want any introduction to the UNIX command line… but that's considered "not programming" and off topic for this site. You also might consider using XCode which provides a graphical interface including a terminal window that runs your program automatically. – Potatoswatter Nov 04 '13 at 10:58