c++ question
John Burski
jburski@cloudnet.com
Wed Dec 25 13:30:00 GMT 2002
I'm sitting here on Christmas day with not a lot to do until later, so I
decided I'd see if I could "sharpen the saw" a bit an work on a bit of
C++ (it has been a long time since I wrote any C++, but I've used it
before). However, to my astonishment and dismay, I can compile from
"program.cpp" to "program.o", but I can't link "program.o" to make
"program". So, I decided to return to my "roots", if you will, and
write a simple little C++ program named "hello" that simply displays
"Hello, World!" in a terminal window (I've attached the source file).
OK, before I go any further, I'm running Red Hat 8.0 (I installed
EVERYTHING - yes, it was a huge install, but I had plenty of room). The
complier is the GNU compiler that came with the install (gcc version 3.2).
I made a series of "Makefiles" to better document my travails. The
first one, "Makefile1", I expected to fail -- and it did (results of the
"make -f Makefile1" command are in "make1.txt"). The results indicated
that I needed to link to the library that contains "cout" and "ostream".
So I proceded to try "Makefile2", the results of which are in "make2.txt".
Becoming a bit frustrated, I built a script that created a combined
table of contents of every ".a" file located in the "/usr/lib"
directory. A quick search of the resulting file shows no instance of an
"ostream.o" object in any of the libraries. Digging a bit deeper into
the /usr/lib directory tree, I found /usr/lib/gcc-lib. So I followed it
down to "/usr/lib/gcc-lib/i386-redhat-linux/3.2". I added this
directory to my /etc/ld.so.conf file and ran ldconfig. I created
"Makefile3", the results of which are in "make3.txt". Since that didn't
work, I created "Makefile4", the results of which are in "make4.txt".
I'm at a loss -- where should I be looking for the proper link libraries?
--
John Burski
@HOME S.I.M.U. (Well, sometimes I am :) )
... and still searching for the cheese!
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: hello.cpp
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20021225/9f8ad8db/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Makefile1
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20021225/9f8ad8db/attachment-0001.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: make1.txt
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20021225/9f8ad8db/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Makefile2
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20021225/9f8ad8db/attachment-0002.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: make2.txt
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20021225/9f8ad8db/attachment-0001.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Makefile3
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20021225/9f8ad8db/attachment-0003.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: make3.txt
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20021225/9f8ad8db/attachment-0002.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Makefile4
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20021225/9f8ad8db/attachment-0004.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: make4.txt
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20021225/9f8ad8db/attachment-0003.txt>
More information about the Gcc-help
mailing list