help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "undefined reference to" errors while linking


From: Paul Pluzhnikov
Subject: Re: "undefined reference to" errors while linking
Date: Wed, 21 Feb 2007 00:32:07 -0800
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux)

wlmparker@gmail.com writes:

> williamP@master-77 ~/workspace/splits/asy g++ -L$LIB -lcygxerces-c27 -
> lxerces-depdom.dll -osplits.exe Trs_Main.o Trs.o Descriptor.o

This command line is backwards.
To understand why libraries must follow objects on command line,
read this: http://webpages.charter.net/ppluzhnikov/linker.html 

However, your errors do not appear to be related to the incorrect
link line order.

For example, one normally would expect to find definition of 
'vtable for Trs' in Trs.o, and definition of 'Descriptor::null_char'
in Descriptor.o

I am guessing that you have something like:

  /// Trs.h
  class Trs {
      ...
      virtual ~Trs(); // never defined
  };

  // Descriptor.h
  class Descriptor {
    ...
    static char null_char; // never defined
  };

If you declare a virtual dtor, you *must* define it (Trs.cpp would
be a good place for it). Ditto for static data members.

Cheers,
-- 
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]