cout errors, why?

cout errors, why?

Post by Jeff Bish » Tue, 24 Dec 1996 04:00:00



Hello everyone,

I did read the faq to try and find this out, but:

The following error is seen ...

c:/djgpp/tmp\ccdaaaaa(.text+0x1a):test.cc: undefined reference to `cout'
c:/djgpp/tmp\ccdaaaaa(.text+0x1f):test.cc: undefined reference to `ostream::operator<<(char const *)'

when trying to compile the following file:

#include <iostream.h>
void main()
{
cout << "hello world";

Quote:}

Pretty simple, I know. Just testing the compiler. Now, the following code
with an extension of .cpp or .c works fine:

#include <stdio.h>
void main()
{
        printf("hello world");

Quote:}

This is using standard <stdio.h> routiens (no c++). Any clues.

My djgpp environment variable is set to c:\djgpp\djgpp.env (I even tried
c:/djgpp/djgpp.env). This is my djgpp.env file:

#= Don't edit this line unless you move djgpp.env outside
#= of the djgpp installation directory.  If you do move
#= it, set DJDIR to the directory you installed DJGPP in.
#=
DJDIR=%:/>DJGPP%

+USER=dosuser
+TMPDIR=%DJDIR%/tmp
+EMU387=%DJDIR%/bin/emu387.dxe
+LFN=n

[bison]
BISON_HAIRY=%DJDIR%/lib/bison.hai
BISON_SIMPLE=%DJDIR%/lib/bison.sim

[cpp]
CPLUS_INCLUDE_PATH=%/>;CPLUS_INCLUDE_PATH%%DJDIR%/lang/cxx;%DJDIR%/include;%DJDIR%/contrib/grx20/include
C_INCLUDE_PATH=%/>;C_INCLUDE_PATH%%DJDIR%/include;%DJDIR%/contrib/grx20/include
OBJCPLUS_INCLUDE_PATH=%/>;OBJCPLUS_INCLUDE_PATH%%DJDIR%/include;%DJDIR%/lang/objc
OBJC_INCLUDE_PATH=%/>;OBJC_INCLUDE_PATH%%DJDIR%/include;%DJDIR%/lang/objc

[gcc]
COMPILER_PATH=%/>;COMPILER_PATH%%DJDIR%/bin
LIBRARY_PATH=%/>;LIBRARY_PATH%%DJDIR%/lib;%DJDIR%/contrib/grx20/lib
...
...

Any ideas??? BTW, I am posting here first to see if it is a problem with
djgpp setup. Sorry if it turns out to be a language problem. I did try
replacing djgpp.env, re-unzipping djdev201.zip, re-unzipping lgp271b.zip, and
re-typing the lines of the program.

Jeff

 
 
 

cout errors, why?

Post by John M. Aldric » Tue, 24 Dec 1996 04:00:00



> I did read the faq to try and find this out, but:

> The following error is seen ...

> c:/djgpp/tmp\ccdaaaaa(.text+0x1a):test.cc: undefined reference to `cout'
> c:/djgpp/tmp\ccdaaaaa(.text+0x1f):test.cc: undefined reference to `ostream::operator<<(char const *)'

You obviously did NOT read the whole FAQ.  Try section 8.7.

--
---------------------------------------------------------------------

| God's final message to His Creation: | http://www.cs.com/fighteer |
| "We apologize for the inconvenience."| Fight against proprietary  |
|                      - Douglas Adams | software - support the FSF!|
---------------------------------------------------------------------

 
 
 

cout errors, why?

Post by DJ Delori » Wed, 25 Dec 1996 04:00:00


Quote:> c:/djgpp/tmp\ccdaaaaa(.text+0x1a):test.cc: undefined reference to `cout'
> c:/djgpp/tmp\ccdaaaaa(.text+0x1f):test.cc: undefined reference to `ostream::operator<<(char const *)'

This is a FAQ.  Add -lstdcxx to the end of your gcc command line.