For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > February 2005 > about APUE by Steve









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author about APUE by Steve
J Wang

2004-04-27, 2:42 am


Dear

I am a newbie on unix programming,

Just reading about APUE by Steve, I test the first program in my SunOS
envirentment using GNU C, added
"ourhdr.h". However, there are some error messages as follows:

gcc -W -ansi -lm /u/cs/p/csmjbw/apue/myls.c
Undefined first referenced
symbol in file
err_sys /var/tmp/ccKBKgpn.o
err_quit /var/tmp/ccKBKgpn.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status

Compilation exited abnormally with code 1 at Mon Apr 26 21:42:17

in the "ourhdr.h", there are only function declaration
void err_quit(const char *, ...);
void err_ret(const char *, ...);
void err_sys(const char *, ...);

How could I do with it?

cheers,


Rich Teer

2004-04-27, 2:42 am

On Mon, 26 Apr 2004, J Wang wrote:

> Dear
>
> I am a newbie on unix programming,
>
> Just reading about APUE by Steve, I test the first program in my SunOS


ITYM "Stevens", as in Rich Stevens.

> envirentment using GNU C, added


Read the README, about compiling the library and example programs.
Or wait until July, when you can buy my book called Solaris Systems
Programming! :-)

--
Rich Teer, SCNA, SCSA

President,
Rite Online Inc.

Voice: +1 (250) 979-1638
URL: http://www.rite-online.net
David Schwartz

2004-04-27, 2:42 am


"J Wang" <csmjbw@bath.ac.uk> wrote in message
news:Pine.GSO.4.44.0404262138430.3711-100000@midge.bath.ac.uk...

> gcc -W -ansi -lm /u/cs/p/csmjbw/apue/myls.c
> Undefined first referenced
> symbol in file
> err_sys /var/tmp/ccKBKgpn.o
> err_quit /var/tmp/ccKBKgpn.o
> ld: fatal: Symbol referencing errors. No output written to a.out
> collect2: ld returned 1 exit status
>
> Compilation exited abnormally with code 1 at Mon Apr 26 21:42:17
>
> in the "ourhdr.h", there are only function declaration
> void err_quit(const char *, ...);
> void err_ret(const char *, ...);
> void err_sys(const char *, ...);
>
> How could I do with it?


You need to link with the actual implementations of those functions.

DS


J Wang

2004-04-27, 2:42 am

In article <c6kbnp$kfg$1@nntp.webmaster.com>,
"David Schwartz" <davids@webmaster.com> writes:
>
> "J Wang" <csmjbw@bath.ac.uk> wrote in message
> news:Pine.GSO.4.44.0404262138430.3711-100000@midge.bath.ac.uk...
>
>
> You need to link with the actual implementations of those functions.
>
> DS
>


you mean I should add the function body in header file?
--
I am Jason.
Matthias Czapla

2004-04-27, 1:10 pm

J Wang wrote:
> In article <c6kbnp$kfg$1@nntp.webmaster.com>,
> "David Schwartz" <davids@webmaster.com> writes:
>
> you mean I should add the function body in header file?


If you did what Stevens README told you, there you should be a file
libmisc.a in /u/cs/p/csmjbw/apue/ and you need to add
"-L/u/cs/csmjbw/apue -lmisc" to the gcc invocation line to link your
program with this library which contains the error functions.

Regards
Matthias
chyojn+group@gmail.com

2005-02-15, 9:00 am

gcc -W -ansi -lm /u/cs/p/csmjbw/apue/myls.c error.c

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com