Thread View: gnu.g++.help
2 messages
2 total messages
Started by Philippe Verdy
Sun, 07 Apr 1996 22:15
Re: [Q] I'm having a problem linking this simple one...
Author: 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.
Re: [Q] I'm having a problem linking this simple one...
Author: Jonathan Martin
Date: Mon, 08 Apr 1996 01:31
Date: Mon, 08 Apr 1996 01:31
30 lines
1771 bytes
1771 bytes
Philippe Verdy (100105.3120@compuserve.com) wrote: : jmartin@personalvision (Jonathan Martin) s'écrit : [[ Deletia ]] : 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. See, this is where my lack of knowledge kicks in. I though I had a grasp on how the compiler/linker worked with static or dynamic bindings, but maybe I'm missing something.. (2 hrs. later) Just checked - CursesW is in libg++.a, but not libg++.so. I tries static with worse errors: it's not linking in curses. And I thought all I'd need is an O'reily book! Thanks for your help -John
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads