Thinking in C and *nix (CSC 282 2015S) : EBoards
Primary: [Front Door] [Schedule] - [Academic Honesty] [Disabilities] [Email] [FAQ] [Teaching & Learning] - [Calendar]
Current: [Outline] [EBoard] [Lab] [Assignment]
Sections: [Assignments] [EBoards] [Examples] [Handouts] [Labs] [Outlines]
Reference: [EBook] - [ISO] [GNU Coding Standards] [GCC Documentation] - [TAoUP] [Make3]
Previous Offerings: [CSC 295 2013S] [CSC 295 2014S]
Misc: [SamR] [Glimmer Labs] [CS@Grinnell] [Grinnell] [Issue Tracker]
Overview
gdb if I can get Stone to teach it.do_workdo_work stdlib.h tells you what's in the standard library,
but doesn't contain the code for that library.sample.c uses fprintf, stdout, and sin.stdout is undefined.#include <stdio.h>, compiled with warnings.
$ make sample.o
cc -c -o sample.o sample.c
sample.c: In function ‘main’:
sample.c:21:49: warning: incompatible implicit declaration of built-in function ‘sin’ [enabled by default]
$ ls
sample.c sample.omain':
sample.c:(.text+0x28): undefined reference tosin'
collect2: error: ld returned 1 exit status
make: * [sample] Error 1#include <math.h>, we can compile without errors.#include <math.h>. Can we still compile
and link? Probably, but with a warning.
LD_LIBRARY_PATH tells the compiler
where to look for those.