Question

What does the -c flag do in the following command?

clang++ -std=c++11 -g -Wall -stdlib=libc++ -isystem testing/gtest-1.7.0/include -Itesting/gtest-1.7.0 -pthread -c testing/gtest-1.7.0/src/gtest-all.cc

I've looked for the flag in the documentation (http://clang.llvm.org/docs/UsersManual.html), as well as in the help message (clang -cc1 --help)...can't seem to find the answer.

Was it helpful?

Solution

The -c flag is used to tell the compiler you don't want to build a program (link together into an executable), just compile this particular file into an object file - typically producing a file called something.o or something.obj - in this case gteger-all.cc

(Note that this flag is common with nearly all compilers available - from Turbo C from 1990's to the latest versions of MS, Gnu and LLVM/Clang)

OTHER TIPS

man clang++

OPTIONS
   Stage Selection Options
       -E  Run the preprocessor stage.

       -fsyntax-only
           Run the preprocessor, parser and type checking stages.

       -S  Run the previous stages as well as LLVM generation and optimization stages and target-specific code generation, producing an assembly file.

       -c  Run all of the above, plus the assembler, generating a target ".o" object file.

man clang is your friend!

OPTIONS
   Stage Selection Options
       -E  Run the preprocessor stage.

       -fsyntax-only
           Run the preprocessor, parser and type checking stages.

       -S  Run the previous stages as well as LLVM generation and optimization
           stages and target-specific code generation, producing an assembly
           file.

       -c  Run all of the above, plus the assembler, generating a target ".o"
           object file.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top