home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / gnu / g / help / 1685 < prev    next >
Encoding:
Internet Message Format  |  1993-01-21  |  3.4 KB

  1. Path: sparky!uunet!olivea!gossip.pyramid.com!pyramid!infmx!jacob
  2. From: jacob@informix.com (Jacob Salomon)
  3. Newsgroups: gnu.g++.help
  4. Subject: So close and yet, so far...
  5. Keywords: Linker, ld, collect
  6. Message-ID: <1993Jan21.004406.6508@informix.com>
  7. Date: 21 Jan 93 00:44:06 GMT
  8. Sender: news@informix.com (Usenet News)
  9. Organization: Informix Software, Inc.
  10. Lines: 88
  11. Originator: jacob@cheetah
  12.  
  13. WOW!  I finally got a complete, clean configure, compile, link, and
  14. install of gcc-2.3.3, as well as the same for libg++-2.3 on my
  15. HP-9000/827 under HP-UX A.08.02 - Sure kept me busy on coffee breaks!
  16.  
  17. So I get around to my fist c++ program: y'know, hello..  But first, I
  18. set my environment variable: INCLUDE=/usr/gnu/lib/g++-include
  19.  
  20. Here is the source file:
  21.  
  22. :   $ cat hello.C
  23. :   #include <iostream.h>
  24. :   main()
  25. :   {
  26. :     cout << "Hello world\n";
  27. :     return 0;
  28. :   }
  29.  
  30. FIrst pass: g++ hello.C
  31. hello.C:1: iostream.h: No such file or directory
  32.  
  33. A quick ls of the $INCLUDE directory shows it is there.  OK, so that
  34. environment variable is not working (yes, I had exported it!).  So I
  35. try the direct assault:
  36.  
  37. $ g++ -I$INCLUDE hello.C
  38. + g++ -I/usr/gnu/lib/g++-include hello.C
  39. ld: Can't find library for -lg++
  40. collect: /bin/ld returned 1 exit status
  41.  
  42. Obviously I have missed some fine points in the build.  Or maybe the
  43. configure.
  44.  
  45. Q1: How do I get g++ to search any particular directory for include
  46.     files?  I'm sure it's somewhere in the 55-page man-page for GCC
  47.     and G++ but it's hard to locate anything by sight and vi searching
  48.     is of no help (no, I haven't installed or learned how to use emacs
  49.     yet) because the man-text is peppered with embedded back-spaces.
  50.     If the INCLUDE environment variable is not the key, what is?
  51.  
  52. Q2: The error message for -lg++ -  It is searching for the library:
  53.     libg++.a, which I have found in 2 subdirectories of where I
  54.     built it: 
  55.  
  56.     71681 1 660084 Jan 19 19:43 /lox/g2.3/libg++-2.3/lib/libg++.a
  57.      4116 1 660084 Jan 19 19:43 /lox/g2.3/libg++-2.3/libg++/libg++.a
  58.  
  59.     I don't know why there are 2 copies of this - They are not links
  60.     to the same file - not even symbolic links.  Where is the linker
  61.     (or collect) looking for them?  in a subdirectory of /usr/gnu/lib?
  62.     I think all I need is to see exactly where it needs to go. I
  63.     already have a symbolic link: 
  64.  
  65.     $ ls -l /usr/gnu/lib
  66.     lrwxr-xr-x   /usr/gnu/lib -> /lox/g2.3/libg++-2.3/lib
  67.  
  68.     Observe the following output:
  69.  
  70.     $ pwd
  71.     /usr/gnu/lib
  72.  
  73.     $ ls -l
  74.     total 1318
  75.     drwxr-xr-x   4 gnu      2048 Jan 19 19:44 g++-include
  76.     drwxr-xr-x   2 gnu        24 Jan 19 19:43 hppa1.0-hp-hpux
  77.     -rw-r--r--   1 gnu    660084 Jan 19 19:43 libg++.a
  78.  
  79.     
  80.     So you see, libg++.a is under /usr/gnu/lib.
  81.  
  82. What am I missing, besides the skill to explain briefly?  ;-)
  83.  
  84. BTW - Note that the configuration was hppa1.0; An addendum in the
  85. README indicates that I should use hppa1.1 for the HP-9000/827.
  86. However, trial and error with 1.37 showed me that 1.0 was the way to
  87. go.  If someone can point out what's happenning, it would be very
  88. helpful as well.
  89.  
  90. Thanks very much.
  91.  
  92.         -- Jake Salomon
  93.         jacob@informix.com
  94.  
  95. Please reply by e-mail.
  96. -- 
  97. ----------------Obligatory smart-$$$ remark:---------------------
  98. | There's two kinds of people: Those who categorize people into |
  99. | two groups and those who don't.   (Barth's Aging proverb.)    |
  100. -----------------------------------------------jacob@informix.com
  101.