Skip to Content
21st Century C, 2nd Edition
book

21st Century C, 2nd Edition

by Ben Klemens
October 2014
Intermediate to advanced content levelIntermediate to advanced
408 pages
10h 19m
English
O'Reilly Media, Inc.
Book available
Content preview from 21st Century C, 2nd Edition

Chapter 1. Set Yourself Up for Easy Compilation

Look out honey ’cause I’m using technology.

Iggy Pop, “Search and Destroy”

The C standard library is just not enough to get serious work done.

Instead, the C ecosystem has expanded outside of the standard, which means that knowing how to easily call functions from common but not-ISO-standard libraries is essential if you want to get past doing textbook exercises. If you want to work with an XML file, a JPEG image, or a TIFF file, then you will need libxml, libjpeg, or libtiff, which are all freely available but not part of the standard. Unfortunately, this is the point where most textbooks taper off and leave you to work it out for yourself, which is why you can find C detractors who will say self-dissonant things like C is 40 years old, so you have to write everything from scratch in it—they never worked out how to link to a library.

Here is the agenda for the chapter:

Set up the requisite tools
This is much easier than it was in the dark days when you had to hunt for every component. You can set up a full build system with all the frills in maybe 10 or 15 minutes (plus all the download time to load so much good stuff).
Compile a C program
Yes, you know how to do this, but we need a setup that has hooks for the libraries and their locations; just typing cc myfile.c doesn’t cut it anymore. Make is just about the simplest system to facilitate compiling programs, so it provides a good model for discussion. I’ll show you the smallest ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Practical C

Practical C

Giulio Zambon
Smaller C

Smaller C

Marc Loy
C in a Nutshell, 2nd Edition

C in a Nutshell, 2nd Edition

Peter Prinz, Tony Crawford

Publisher Resources

ISBN: 9781491904428Errata Page