Compiling and Linking the Source Code

Although the source code in your file is somewhat cryptic, and anyone who doesn't know C++ will struggle to understand what it is for, it is still in what we call human-readable form. Your source code file is not a program, and it can't be executed or run as a program can.

To turn your source code into a program, a compiler is used. How you invoke your compiler and how you tell it where to find your source code will vary from compiler to compiler; check your documentation.

If you compile the source code from the operating system's command line, type the following:

For the Bloodshed compiler gcc <filename> -o ...

Get Sams Teach Yourself C++ in 24 Hours, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.