Skip to main content

Section 28.13 Make an Executable Program

Activity 28.8.

Finally, link it all together and make an executable program:
gcc -o testComplex testComplex.o complexlib.o -lm
  • Without the -c flag, gcc creates an executable file.
  • The -o flag specifies the name of the output file "testComplex".
  • All of the object files that are to be linked together are listed.
  • The -lm flag forces the inclusion of the mathematics library.
Running the executable program:
./testComplex
  • ./ indicates that the executable is located in the current directory. This is how you typically run programs under Linux. On the engs20 servers you don’t have to type this part.