This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: undefined reference to 'class::function' error

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.



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

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

#ifndef LLIST_H
#define LLIST_H

#include "cone.h"

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

class NList {

  NCone *head;

  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);



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);
      NConeF *q;
      q=new NConeF(p,head->next);


----- Original Message ----- 
From: "Igor Pechtchanski" <>
To: "Kai Xu (Kevin)" <>
Cc: <>
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
> > internet and just can not find a answer. I know little about c++ and
> > so please bear with me. The problem is like this:
> >
> > I need to use someone else's c++ package under windows xp. The package
> > initially developed using GCC in UNIX and works fine when I tried it
> > 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
> > anyway to get it working using cygwin?
> >
> > Thanks in advance,
> > Kevin
> Kevin,
> You're going to have to be more specific than that.
> Igor
> -- 
>       |\      _,,,---,,_
> ZZZzz /,`.-'`'    -.  ;-;;,_
>      |,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:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]