alp-ch01-advanced-unix-programming-with-linux

alp-ch01-advanced-unix-programming-with-linux - 01 0430...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Advanced UNIX Programming with Linux I 1 Getting Started 2 Writing Good GNU/Linux Software 3 Processes 4 Threads 5 Interprocess Communication
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
Getting Started 1 T HIS CHAPTER SHOWS YOU HOW TO PERFORM THE BASIC steps required to create a C or C++ Linux program. In particular, this chapter shows you how to create and modify C and C++ source code, compile that code, and debug the result. If you’re already accustomed to programming under Linux, you can skip ahead to Chapter 2, “Writing Good GNU/Linux Software;” pay careful attention to Section 2.3,“Writing and Using Libraries,” for information about static versus dynamic linking that you might not already know. Throughout this book, we’ll assume that you’re familiar with the C or C++ pro- gramming languages and the most common functions in the standard C library.The source code examples in this book are in C, except when demonstrating a particular feature or complication of C++ programming.We also assume that you know how to perform basic operations in the Linux command shell, such as creating directories and copying files. Because many Linux programmers got started programming in the Windows environment, we’ll occasionally point out similarities and contrasts between Windows and Linux.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 Chapter 1 Getting Started 1.1 Editing with Emacs An editor is the program that you use to edit source code. Lots of different editors are available for Linux, but the most popular and full-featured editor is probably GNU Emacs. About Emacs Emacs is much more than an editor. It is an incredibly powerful program, so much so that at CodeSourcery, it is affectionately known as the One True Program, or just the OTP for short. You can read and send email from within Emacs, and you can customize and extend Emacs in ways far too numerous to discuss here. You can even browse the Web from within Emacs! If you’re familiar with another editor, you can certainly use it instead. Nothing in the rest of this book depends on using Emacs. If you don’t already have a favorite Linux editor, then you should follow along with the mini-tutorial given here. If you like Emacs and want to learn about its advanced features, you might consider reading one of the many Emacs books available. One excellent tutorial, Learning GNU Emacs , is written by Debra Cameron, Bill Rosenblatt, and Eric S. Raymond (O’Reilly, 1996). 1.1.1 Opening a C or C++ Source File You can start Emacs by typing emacs in your terminal window and pressing the Return key.When Emacs has been started, you can use the menus at the top to create a new source file. Click the Files menu, choose Open Files, and then type the name of the file that you want to open in the “minibuffer” at the bottom of the screen. 1 If you want to create a C source file, use a filename that ends in .c or .h . If you want to create a C++ source file, use a filename that ends in .cpp , .hpp , .cxx , .hxx , .C , or .H .
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 08/16/2010.

Page1 / 16

alp-ch01-advanced-unix-programming-with-linux - 01 0430...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online