Sunday, June 5, 2022

[SOLVED] Are there compiler options in clang

Issue

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.


Solution

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.



Answered By - Potatoswatter
Answer Checked By - Senaida (WPSolving Volunteer)