delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/10/09/09:38:54

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <028901c38e6a$a028eca0$db406682@itee.uq.edu.au>
Reply-To: "Kai Xu \(Kevin\)" <kaixu AT itee DOT uq DOT edu DOT au>
From: "Kai Xu \(Kevin\)" <kaixu AT itee DOT uq DOT edu DOT au>
To: <pechtcha AT cs DOT nyu DOT edu>
Cc: <cygwin AT cygwin DOT com>
References: <028301c38e65$3d4a5ab0$db406682 AT itee DOT uq DOT edu DOT au> <Pine DOT GSO DOT 4 DOT 56 DOT 0310090904550 DOT 15176 AT slinky DOT cs DOT nyu DOT edu>
Subject: Re: undefined reference to 'class::function' error
Date: Thu, 9 Oct 2003 23:38:29 +1000
Organization: ITEE, The Univeristy of Queensland
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
X-Spam-Checked: This message probably not SPAM
X-Spam-Score: -1
X-Spam-Tests: QUOTED_EMAIL_TEXT,REFERENCES
X-Spam-Report: -1.00 points, 8 required;
* -0.5 -- Has a valid-looking References header
* -0.5 -- BODY: Contains what looks like a quoted email text
X-Scanned-By: MIMEDefang 2.35
Note-from-DJ: This may be spam

I guess I can only post a example of the errors here, as the main program is
about 2k lines and compiler doesn't tell where the error occurs. I am not
good at c++ and this is not my program, so please let me know if I am not
posting the right thing or anything is missing.

Cheers,

Kevin

The error message:
undefined reference to `NList::insert(Cone*, double, int)'

The declaration of "NList" in the .h file (I omit other structs and
classes):

#ifndef LLIST_H
#define LLIST_H

#include "cone.h"

#define NCONE 1
#define NCONEF 2
#define NCONEP 3

class NList {

  NCone *head;

  public:
  NCone *getHead();
  void insert(Cone *p, int type);
  void insert(Cone *p, double fraction, int type);            // I think
this the function the error refers to
  void insert(Cone *p, double r1, double r2, double l1, double l2);
  void findPoints(NConeP *np, Cone *p);
  int remove(int label, int type);
  int remove(Cone *c, int type);
  NCone *find(int label);
  NList();
  ~NList();

};

#endif

Following is the actual NList::insert, in a .cpp file other than the main
.cpp file

void NList::insert(Cone *p, double fraction, int type)
{

  if (type == NCONE)
    {
      NCone *q;
      q=new NCone(p,head->next);
      head->next=q;
    }
  else
    {
      NConeF *q;
      q=new NConeF(p,head->next);
      q->fraction=fraction;
      head->next=q;
    }

}




----- Original Message ----- 
From: "Igor Pechtchanski" <pechtcha AT cs DOT nyu DOT edu>
To: "Kai Xu (Kevin)" <kaixu AT itee DOT uq DOT edu DOT au>
Cc: <cygwin AT cygwin DOT com>
Sent: Thursday, October 09, 2003 11:05 PM
Subject: Re: undefined reference to 'class::function' error


> On Thu, 9 Oct 2003, Kai Xu (Kevin) wrote:
>
> > Hi there,
> >
> > I guess this is a very simple question, but I searched all the achieves
and
> > internet and just can not find a answer. I know little about c++ and
UNIX,
> > so please bear with me. The problem is like this:
> >
> > I need to use someone else's c++ package under windows xp. The package
is
> > initially developed using GCC in UNIX and works fine when I tried it
under
> > UNIX. When I try to compile the main .cpp file using g++ of cygwin in
xp, I
> > get a lot of error messages like:
> >
> > undefined reference to 'class::function'
> >
> > where the 'class' is defined in a separate .cpp file and its .h file is
> > included in the main file. The program compile properly under UNIX, is
there
> > anyway to get it working using cygwin?
> >
> > Thanks in advance,
> > Kevin
>
> Kevin,
>
> You're going to have to be more specific than that.
> Igor
> -- 
> http://cs.nyu.edu/~pechtcha/
>       |\      _,,,---,,_ pechtcha AT cs DOT nyu DOT edu
> ZZZzz /,`.-'`'    -.  ;-;;,_ igor AT watson DOT ibm DOT com
>      |,4-  ) )-,_. ,\ (  `'-' Igor Pechtchanski, Ph.D.
>     '---''(_/--'  `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!
>
> "I have since come to realize that being between your mentor and his route
> to the bathroom is a major career booster."  -- Patrick Naughton
>


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019