public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Edmund Green <edmund@greenius.co.uk>
To: W L A Au <eem1wa@eim.surrey.ac.uk>
Cc: gcc-help@gcc.gnu.org
Subject: Re: Inverse Matrix Implementation Problem...
Date: Thu, 04 Jul 2002 07:08:00 -0000	[thread overview]
Message-ID: <3D2456CF.5000904@greenius.co.uk> (raw)
In-Reply-To: <1128.131.227.74.155.1025652431.squirrel@ike.ee.surrey.ac.uk>

re:
> Please help me. I've encounter some problems when I try to implement the
> inverse matrix function by using the Gauss-Jordan Elimination routine,
> which is provided by the Numerical Recipes in C, Chapter 2.1
...
 > However, when I use the gcc compiler command:
> gcc test2.c -o test2
> 
> I've got the following error message:
> 
> Undefined			first referenced
>  symbol  			    in file
> free_ivector                        /var/tmp/cc4v8fRq.o
> ivector                             /var/tmp/cc4v8fRq.o
> nrerror                             /var/tmp/cc4v8fRq.o
> ld: fatal: Symbol referencing errors. No output written to test2
> collect2: ld returned 1 exit status

These missing library routines are found in the nrutil.c file (see 
Appendix B of the book), to save having to duplicate them for each 
example in the book.

This makes your compilation more complex, you should really be using 
makefiles for anything with more than 1 source file (see "info make").
They are a very powerful but can also get very complicated.

However in this simple case, if you don't mind 'make' doing a few things 
behind your back with its built in implicit rules, create a file called 
"makefile" with the following single line in it

test2 : test2.o nrutil.o

and put in in a directory that also contains "test2.c", "nrutil.h" and 
"nrutil.c", then run the command "make".


Edmund.

      parent reply	other threads:[~2002-07-04 14:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-02 16:27 W L A Au
2002-07-03  7:23 ` zhenggen
2002-07-04  7:08 ` Edmund Green [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3D2456CF.5000904@greenius.co.uk \
    --to=edmund@greenius.co.uk \
    --cc=eem1wa@eim.surrey.ac.uk \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).