Article View: gnu.g++.help
Article #941Re: [Q] I'm having a problem linking this simple one...
From: Philippe Verdy
Date: Sun, 07 Apr 1996 22:15
Date: Sun, 07 Apr 1996 22:15
42 lines
1913 bytes
1913 bytes
jmartin@personalvision (Jonathan Martin) s'Γ©crit :
> Ok, I'm teaching myself c++, so bare with me.
>
> When I compile this:
> #include <CursesW.h>
> main () {
> CursesWindow mine (20,20,5,5);
> }
> with the command line:
>
> g++ -I/usr/include/ncurses -ohello hello.cc
>
> I get this from the linker:
>
> /tmp/cca...: undefined reference to 'CursesWindow::~CursesWindow(void)'
> /tmp/cca...: undefined reference to 'CursesWindow::CursesWindow(int,int,int,int)'
>
> I checked the command line that g++ is feeding to ld, and -lg++ is
> there. I made a hello.o and checked the symbol table, and the symbols
> that ld's having trouble with seem to match those in libg++ ok. I
> dunno. Like I said, I'm new at this.
>
> Any help would be greatly appreciated.
>
> -Jon
> jmartin@snet.net
>
May be -lg++ is not enough to find your library.
You may also need to use the -L/usr/g++/lib or other
to specify where to search for libraries.
Beware also of what kind of library you use.
Don't you link with dynamic link libraries and only have a
static library for Curses ? if so, add a binding option
before the -lg++ (e.g. -dy or -dn with Sun linker).
Did you compile the Curses library with the same version
of the compiler ? if not, may be the mangling rules differ
from your library to your compiler.
Do you use the correct set of libraries (for other versions
of g++ for example). Check your environment variables...
Do you use the right version of g++ ? Try "g++ -v"...
Hope this will help.
Technical Details
Message-ID:
<4k9eqe$fl9@arl-news-svc-5.compuserve.com>Path:
arc1-ca.pugleaf.net!news.compuserve.com!newsmasterShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!news.compuserve.com!newsmaster From: Philippe Verdy <100105.3120@compuserve.com> Newsgroups: gnu.g++.help,comp.lang.c++ Subject: Re: [Q] I'm having a problem linking this simple one... Date: 7 Apr 1996 22:15:42 GMT Organization: CompuServe Incorporated Message-ID: <4k9eqe$fl9@arl-news-svc-5.compuserve.com> NNTP-Posting-Host: ad04-110.compuserve.com