Mail Archives: djgpp/1997/11/14/03:46:20
Ofer Corshid wrote:
>
> #include <iostream.h>
>
> void main()
> {
> cout << "test";
> }
>
> When I enter this command:
> gcc myfile.cc -o myfile.exe
>
> I get this messages:
> undefined reference to 'cout'
> undefined reference to 'ostream::operator<<(char const *)'
You forgot to link in the C++ libraries, as instructed in 'readme.1st'.
If you didn't read that file, please do so. You can link the libraries
either by adding '-lgcc' (or -lstdcx or -liostr) to the end of your
command line, or by substituting 'gxx' for 'gcc'.
P.S.: void main() is illegal C/C++. main() must always return an
integer. If you add '-Wall' to your command line, it will catch lots of
pesky little errors that you probably wouldn't find otherwise.
hth
--
---------------------------------------------------------------------
| John M. Aldrich | "History does not record anywhere at |
| aka Fighteer I | any time a religion that has any |
| mailto:fighteer AT cs DOT com | rational basis." |
| http://www.cs.com/fighteer | - Lazarus Long |
---------------------------------------------------------------------
- Raw text -