For Dummies 978-0-470-77019-1 Scheda Tecnica

Navigare online o scaricare Scheda Tecnica per Manuali per software For Dummies 978-0-470-77019-1. For Dummies Linux All-in-One, 4th Edition Manuale Utente

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 26
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 0
Chapter 1: Programming in Linux
In This Chapter
Figuring out programming
Exploring the software-development tools in Linux
Compiling and linking programs with GCC
Using make
Debugging programs with gdb
Understanding the implications of GNU, GPL, and LGPL
L
inux comes loaded with all the tools you need to develop software. (All
you have to do is install them.) In particular, it has all the GNU soft-
ware-development tools, such as GCC (C and C++ compiler), GNU make, and
the GNU debugger. This chapter introduces you to programming, describes
the software-development tools, and shows you how to use them. Although
I provide examples in the C and C++ programming languages, the focus is
not on showing you how to program in those languages but on showing you
how to use various software-development tools (such as compilers, make,
and debugger).
The chapter concludes with a brief explanation of how the Free Software
Foundation’s GNU General Public License (GPL) may affect any plans you
might have to develop Linux software. You need to know about the GPL
because you use GNU tools and GNU libraries to develop software in Linux.
An Overview of Programming
If you’ve written computer programs in any programming language, you can
start writing programs on your Linux system quickly. If you’ve never written
a computer program, however, you need two basic resources before you
begin to write code: a look at the basics of programming and a quick review
of computers and their major parts. This section offers an overview of com-
puter programming — just enough to get you going.
A simplified view of a computer
Before you get a feel for computer programming, you need to understand
where computer programs fit in with the overall scheme of computing.
42_770191-bk08ch01.indd 52742_770191-bk08ch01.indd 527 8/6/10 9:51 AM8/6/10 9:51 AM
COPYRIGHTED MATERIAL
Vedere la pagina 0
1 2 3 4 5 6 ... 25 26

Sommario

Pagina 1 - COPYRIGHTED MATERIAL

Chapter 1: Programming in LinuxIn This Chapter✓ Figuring out programming✓ Exploring the software-development tools in Linux✓ Compiling and linking pro

Pagina 2 - An Overview of Programming

536Exploring the Software-Development Tools in LinuxTable 1-1 (continued)Option Meaning-fPICGenerates position-independent code (PIC) suitable for use

Pagina 3 - Role of the operating system

Book VIIIChapter 1Programming in Linux537Exploring the Software-Development Tools in LinuxThe GNU make utilityWhen an application is made up of more t

Pagina 4

538Exploring the Software-Development Tools in LinuxSuppose that you have a C++ source file named form.C that contains the following preprocessor dire

Pagina 5

Book VIIIChapter 1Programming in Linux539Exploring the Software-Development Tools in LinuxThis rule specifies an abstract target named clean that does

Pagina 6 - GNU C and C++ compilers

540Exploring the Software-Development Tools in LinuxTable 1-2 (continued)Variable Meaning$?Names of all dependent files (with spaces between the names

Pagina 7

Book VIIIChapter 1Programming in Linux541Exploring the Software-Development Tools in Linux########################################################## S

Pagina 8 - Compiling C++ programs

542Exploring the Software-Development Tools in LinuxEven when you have a makefile with a default name such as Makefile, you may want to build a specif

Pagina 9 - Table 1-1 Common GCC Options

Book VIIIChapter 1Programming in Linux543Exploring the Software-Development Tools in LinuxOption Meaning-mIgnores the variable given but accepts that

Pagina 10 - Table 1-1 (continued)

544Exploring the Software-Development Tools in LinuxPreparing to debug a programIf you want to debug a program by using gdb, you have to ensure that t

Pagina 11 - The GNU make utility

Book VIIIChapter 1Programming in Linux545Exploring the Software-Development Tools in LinuxTo quit gdb, type q and then press Enter.gdb has a large num

Pagina 12

528An Overview of ProgrammingFigure 1-1 shows a simplified view of a computer, highlighting the major parts that are important to a programmer. Figure

Pagina 13 - Variables (or macros)

546Exploring the Software-Development Tools in LinuxTable 1-4 (continued)info varDisplays all global and static variable names.killEnds the program yo

Pagina 14 - A sample makefile

Book VIIIChapter 1Programming in Linux547Exploring the Software-Development Tools in Linux#include <stdio.h>static char buf[256];void read_input

Pagina 15 - How to run make

548Exploring the Software-Development Tools in Linux 2. Start executing the program under gdb by typing the run command. When the program prompts for

Pagina 16

Book VIIIChapter 1Programming in Linux549Exploring the Software-Development Tools in Linux At this point, you can narrow the problem to the variabl

Pagina 17 - The GNU debugger

550Understanding the Implications of GNU LicensesUnderstanding the Implications of GNU LicensesYou have to pay a price for the bounty of Linux. To pro

Pagina 18 - Preparing to debug a program

Book VIIIChapter 1Programming in Linux551Understanding the Implications of GNU LicensesThe software that the GPL covers isn’t in the public domain. So

Pagina 19 - (continued)

552Understanding the Implications of GNU LicensesThe LGPL is intended to allow use of libraries in your applications, even if you don’t distribute sou

Pagina 20 - Finding bugs by using gdb

Book VIIIChapter 1Programming in Linux529An Overview of ProgrammingFor a programmer, the other two important items are the input and the output — the

Pagina 21

530An Overview of Programmingone or more options — the command is the first word in the line and the rest are the options (specific behaviors for the

Pagina 22

Book VIIIChapter 1Programming in Linux531Exploring the Software-Development Tools in LinuxThese steps are referred to as the edit-compile-debug cycle

Pagina 23 - Fixing bugs in gdb

532Exploring the Software-Development Tools in Linux ✦ A debugger for debugging programs. Linux includes the GNU debugger gdb. ✦ A version-control sys

Pagina 24

Book VIIIChapter 1Programming in Linux533Exploring the Software-Development Tools in Linuxaccomplish this use the following program source; the task t

Pagina 25

534Exploring the Software-Development Tools in LinuxIf you have too many source files to compile and link, you can compile the files individually and

Pagina 26

Book VIIIChapter 1Programming in Linux535Exploring the Software-Development Tools in LinuxA host of GCC options controls various aspects of compiling

Commenti su questo manuale

Nessun commento