Now, looking at each part of that command:
CC | This is the command that says "Compile my C++ program."
Notice that this is capital CC not lower case. Unix is very "case sensitive" i.e. there can be a huge difference in meaning between characters in upper case and those same characters in lower case. |
-o hello | This is called the "minus-oh" option.
It tells the linker to create an executable file as specified by the name following -o. It is a convention to name your executable file the same name as the source file without the .cpp extension. Without the minus-oh option your executable file will be, by default, a.out |
hello.cpp | This is the name of the C++ program.
Notice that you need to use the extension .cpp |
-c
option to compile a C++ module, but
not
produce an executable file.
This will produce an object file with a
.o
extension.
Call the C++ compiler again to link each
.o
file.
e.g.
CC -c part1.cpp
CC -c part2.cpp CC -o hello part1.o part2.o |
This page has been accessed
times.
Last modified: Friday, 21-Aug-2020 15:28:14 CST
Copyright 2002 Department of Computer Science, University of Regina.