Re: gcc linker-error's
[linking C++ code with gcc fails]:
> gcc -o test test.cc
>
> both give the following (linker) errors:
>
> /tmp/cca001121.o: In function `main':
> /tmp/cca001121.o(.text+0x13): undefined reference to `cout'
> /tmp/cca001121.o(.text+0x13): undefined reference to
> `ostream:operator<<(char const *)'
>
> does anyone have a solution to this problem.
Use 'g++' instead of 'gcc' when compiling C++ code; it'll tell the
linker to link with the correct libraries for C++ code
('iostream' or 'stdc++', I believe).
Now for the next error you'll probably experience.
"test doesn't produce any output".
That's right... if you call it with simply "test", you'll start
"/bin/test" instead of "./test".
Hope this helps,
Ray
--
ART A friend of mine in Tulsa, Okla., when I was about eleven years old.
I'd be interested to hear from him. There are so many pseudos around taking
his name in vain.
- The Hipcrime Vocab by Chad C. Mulligan
--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-REQUEST@lists.debian.org . Trouble? e-mail to Bruce@Pixar.com
Reply to: