Answer the question
In order to leave comments, you need to log in
C header file connection error (in what)?
I'm trying to run the copy.c file (example 4-1) from the
Linux Programming Interface book .
In the main file copy.c, the file "tlpi_hdr.h" [written by the author] is included; #include "tlpi_hdr.h"
the file "error_functions.h" [written by the author] is #include "error_functions.h"
included. There are no functions in the file "tlpi_hdr.h" - only macro definitions, but in the self-written file error_functions. c there are functions that are used in the main file and when compiling the copy.c file, errors occur related to the use of functions from the file "error_functions.h"
In function `main':
copy.c:(.text+0x67): undefined reference to `usageErr'
copy.c:(.text+0xb6): undefined reference to `errExit'
copy.c:(.text+0x122) : undefined reference to `errExit'
Answer the question
In order to leave comments, you need to log in
when compiling file copy.c throws errors
In function `main':
copy.c:(.text+0x67): undefined reference to `usageErr'
copy.c:(.text+0xb6): undefined reference to `errExit'
copy. c:(.text+0x122): undefined reference to `errExit'
These are linking errors, not compilation errors. The file copy.c compiled fine.
To link you need to link with error_functions.o:gcc copy.c error_functions.c -o copy
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question