From: jacob@informix.com (Jacob Salomon)
Newsgroups: gnu.g++.help
Subject: So close and yet, so far...
Keywords: Linker, ld, collect
Date: 21 Jan 93 00:44:06 GMT
Organization: Informix Software, Inc.
Originator: jacob@cheetah

WOW!  I finally got a complete, clean configure, compile, link, and
install of gcc-2.3.3, as well as the same for libg++-2.3 on my
HP-9000/827 under HP-UX A.08.02 - Sure kept me busy on coffee breaks!

So I get around to my fist c++ program: y'know, hello..  But first, I
set my environment variable: INCLUDE=/usr/gnu/lib/g++-include

Here is the source file:

:   $ cat hello.C
:   #include <iostream.h>
:   main()
:   {
:     cout << "Hello world\n";
:     return 0;
:   }

FIrst pass: g++ hello.C
hello.C:1: iostream.h: No such file or directory

A quick ls of the $INCLUDE directory shows it is there.  OK, so that
environment variable is not working (yes, I had exported it!).  So I
try the direct assault:

$ g++ -I$INCLUDE hello.C
+ g++ -I/usr/gnu/lib/g++-include hello.C
ld: Can't find library for -lg++
collect: /bin/ld returned 1 exit status

Obviously I have missed some fine points in the build.  Or maybe the
configure.

Q1: How do I get g++ to search any particular directory for include
    files?  I'm sure it's somewhere in the 55-page man-page for GCC
    and G++ but it's hard to locate anything by sight and vi searching
    is of no help (no, I haven't installed or learned how to use emacs
    yet) because the man-text is peppered with embedded back-spaces.
    If the INCLUDE environment variable is not the key, what is?

Q2: The error message for -lg++ -  It is searching for the library:
    libg++.a, which I have found in 2 subdirectories of where I
    built it: 

    71681 1 660084 Jan 19 19:43 /lox/g2.3/libg++-2.3/lib/libg++.a
     4116 1 660084 Jan 19 19:43 /lox/g2.3/libg++-2.3/libg++/libg++.a

    I don't know why there are 2 copies of this - They are not links
    to the same file - not even symbolic links.  Where is the linker
    (or collect) looking for them?  in a subdirectory of /usr/gnu/lib?
    I think all I need is to see exactly where it needs to go. I
    already have a symbolic link: 

    $ ls -l /usr/gnu/lib
    lrwxr-xr-x   /usr/gnu/lib -> /lox/g2.3/libg++-2.3/lib

    Observe the following output:

    $ pwd
    /usr/gnu/lib

    $ ls -l
    total 1318
    drwxr-xr-x   4 gnu      2048 Jan 19 19:44 g++-include
    drwxr-xr-x   2 gnu        24 Jan 19 19:43 hppa1.0-hp-hpux
    -rw-r--r--   1 gnu    660084 Jan 19 19:43 libg++.a

    
    So you see, libg++.a is under /usr/gnu/lib.

What am I missing, besides the skill to explain briefly?  ;-)

BTW - Note that the configuration was hppa1.0; An addendum in the
README indicates that I should use hppa1.1 for the HP-9000/827.
However, trial and error with 1.37 showed me that 1.0 was the way to
go.  If someone can point out what's happenning, it would be very
helpful as well.

Thanks very much.

		-- Jake Salomon
		jacob@informix.com

Please reply by e-mail.
-- 
----------------Obligatory smart-$$$ remark:---------------------
| There's two kinds of people: Those who categorize people into |
| two groups and those who don't.   (Barth's Aging proverb.)    |
-----------------------------------------------jacob@informix.com
Newsgroups: gnu.g++.help