public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Alex Triffitt" <alextriffitt@hotmail.com>
To: "Michael Eager" <eager@eagercon.com>
Cc: gcc-help@gcc.gnu.org
Subject: RE: undefined reference to `x'
Date: Wed, 02 Aug 2006 18:28:00 -0000	[thread overview]
Message-ID: <BAY102-W7476B011BBF4065C7BAE4D9520@phx.gbl> (raw)

drawWindow.cpp,  contains the following

drawWindow::drawWindow(vizManager* passedPtr)
{
  DRAW_topoFactory = new TOPO2D_Factory();
  DRAW_raycaster = new TOPO2D_Raycaster(DRAW_topoFactory);
  resetDrawWindow();
  managerPtr = passedPtr;
} // end of drawWindow constructor


drawWindow::~drawWindow()
{
}

Cheers Alex



----------------------------------------
> Date: Wed, 2 Aug 2006 10:11:52 -0700
> From: eager@eagercon.com
> To: alextriffitt@hotmail.com
> CC: gcc-help@gcc.gnu.org
> Subject: Re: undefined reference to `x'
> 
> Alex Triffitt wrote:
> > I am trying to compiled a rather complicated program. And I am constantly getting the error:
> > "undefined reference to `<x>'" where x is a function in a class. For example I have the file vizManager.cpp which has at the very top the statment #include "drawWindow.h". Within vizManager.cpp there is a call to create a drawWindow object through the line "drawWindow(this)". The vizManager.cpp file compiles perfectly fine but when it comes to linking with the line:
> > 
> > g++ -g -o iNSpect configFile.o eventBuilder.o vizNodeList.o vizNode.o vizLine.o iNSpect.o vizProperties.o simWindow.o toolkitWindow.o vizManager.o nodeStats.o -pthread -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lgthread-2.0 -lglib-2.0   -Wl,--export-dynamic -lgtkglext-x11-1.0 -lgdkglext-x11-1.0 -lGLU -lGL -lgtk-x11-2.0 -lpangox-1.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0
> > 
> > I get the following error;
> > 
> > vizManager.o: In function `~vizManager':/home/triff/inspect-triff-beta/src/vizManager.cpp:99: undefined reference to `drawWindow::~drawWindow()'
> > :/home/triff/inspect-triff-beta/src/vizManager.cpp:99: undefined reference to `drawWindow::~drawWindow()'
> > vizManager.o: In function `vizManager':/home/triff/inspect-triff-beta/src/vizManager.cpp:51: undefined reference to `drawWindow::drawWindow(vizManager*)'
> > :/home/triff/inspect-triff-beta/src/vizManager.cpp:84: undefined reference to `drawWindow::~drawWindow()'
> > :/home/triff/inspect-triff-beta/src/vizManager.cpp:51: undefined reference to `drawWindow::drawWindow(vizManager*)'
> > :/home/triff/inspect-triff-beta/src/vizManager.cpp:84: undefined reference to `drawWindow::~drawWindow()'
> > 
> > The only way I have found around this is by adding the following lines near the top of vizManager.cpp:
> > 
> > drawWindow::drawWindow(vizManager*)
> > {
> > }
> > drawWindow::~drawWindow()
> > {
> > }
> > 
> > This I don't think actually fixes the problem because then these functions are called do nothing and therefore cause a lot of errors.
> > 
> > Does anyone know what is going wrong? Is this a linking problem? Or a library problem? or something totally different. I suspect this is something to do with the fact I am trying to compile using GCC version 4.1.0 when the program was orginally written for an earlier version.
> 
> How are the constructors and destructor for the drawWindow class
> declared and defined?
> 
> My guess is that you only have these declared in the class,
> without providing bodies for the member functions.
> 
> 
> 
> -- 
> Michael Eager	 eager@eagercon.com
> 1960 Park Blvd., Palo Alto, CA 94306  650-325-8077

             reply	other threads:[~2006-08-02 17:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-02 18:28 Alex Triffitt [this message]
2006-08-02 20:30 ` Tony Wetmore
2006-08-02 20:32 ` Michael Eager
  -- strict thread matches above, loose matches on Subject: below --
2006-08-03  9:04 Alex Triffitt
2006-08-04 10:34 ` Michael Eager
2006-08-02 17:11 Alex Triffitt
2006-08-02 17:53 ` Michael Eager
2006-08-02 21:59 ` Ingo Krabbe

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=BAY102-W7476B011BBF4065C7BAE4D9520@phx.gbl \
    --to=alextriffitt@hotmail.com \
    --cc=eager@eagercon.com \
    --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).