Re: gcc linker-error's

1996-10-14 Thread J.H.M.Dassen
[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
[EMAIL PROTECTED] . Trouble? e-mail to [EMAIL PROTECTED]


gcc linker-error's

1996-10-14 Thread Niels Bo Johansen
I have tried to compile the most simple C++ program whith the gcc 
compiler (2.7.2). I do not have the exact source code, but it's 
something like:

#include 

void main() {
  int i = 9;
  
  cout << " write a some text.\n";

}

saved in a file called test.cc. 
Trying the following:

   gcc -c test.cc (works fine indicating the the compiler accepts 
   the input)
   gcc -L test test.o (assuming test.o made as above)

or simply

   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. Besides gcc and binutils 
I have installed: libc5-dev-5.2.18-9.deb, libg++27-2.7.1-2.deb. Also I 
have tried with: libobjects-0.1.19-1.deb but it didn't help.

thanks in advance, Niels Bo Johansen

--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
[EMAIL PROTECTED] . Trouble? e-mail to [EMAIL PROTECTED]