delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/31/22:43:45

From: JustIn <seismic AT geocities DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: C++ undefined references in libgpp.a to '__dj_blah' using 'cout' ?
Date: Mon, 31 Mar 1997 15:03:31 -0500
Organization: lucid designs
Lines: 128
Message-ID: <33401893.3C09@geocities.com>
Reply-To: seismic AT geocities DOT com
NNTP-Posting-Host: 170-145-127.ipt.aol.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I'm using RSXNTDJ for Win32.

I have a simple C++ file (compacted):

#include <iostream.h>
void main(int argc, char **argv)
{
// ------------THE FOLLOWING LINE CAUSES _ALL_ THE LINKING ERRORS BELOW!
  cout << "Pausing..." << endl;
}

Here's my dumb Makefile (hints desired):
-------------------------------------------
CC = gxx -Zwin32
CFLAGS = -Wall -O3 -m486

OPT = rsxntopt
RM = rm -f

.cc.o :
        $(CC) -c $(CFLAGS) $<

prog.exe : prog.o
        $(CC) $(CFLAGS) -o prog.tmp prog.o
        $(OPT) -b prog.exe -c -V
        $(RM) prog.tmp
------------------------------------------

Here's the output:

gxx -v -Zwin32 -c -O3 -m486 prog.cc
Reading specs from e:/dj/rsxntdj/lib\specs
gcc version 2.7.2.1
 e:\dj/bin\cpp.exe -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2
-D__cplusplus -D__GNUC_MINOR__=7 -Dunix -Di386 -DGO32 -DMSDOS -DDJGPP=2
-DDJGPP_MINOR=0 -D__unix__ -D__i386__ -D__GO32__ -D__MSDOS__
-D__DJGPP__=2 -D__DJGPP_MINOR__=0 -D__unix -D__i386 -D__GO32 -D__MSDOS
-D__DJGPP=2 -D__DJGPP_MINOR=0 -D__OPTIMIZE__ -D__WIN32__ -D__EMX__
-Ie:/dj/rsxntdj/include -Ie:/dj/rsxntdj/include/win32 prog.cc
c:\windows\temp\ccbaaaaa
GNU CPP version 2.7.2.1 (80386, BSD syntax)
#include "..." search starts here:
#include <...> search starts here:
 e:/dj/rsxntdj/include
 e:/dj/rsxntdj/include/win32
 e:\dj/lang/cxx
 e:\dj/include
 e:\dj/contrib/grx20/include
 /usr/local/lib/g++-include
 /usr/local/include
 /usr/local/go32/include
 /usr/local/lib/gcc-lib/go32/2.7.2.1/include
 /usr/include
End of search list.
 e:\dj/bin\cc1plus.exe c:\windows\temp\ccbaaaaa -fno-strength-reduce
-fno-strength-reduce -quiet -dumpbase prog.cc -m486 -O3 -version -o
c:\windows\temp\cccaaaaa
GNU C++ version 2.7.2.1 (80386, BSD syntax) compiled by GNU C version
2.7.2.1.
 e:\dj/bin\as.exe -o prog.o c:\windows\temp\cccaaaaa
gcc.exe: -lgpp: linker input file unused since linking not done
gcc.exe: -lstdcx: linker input file unused since linking not done
gcc.exe: -lm: linker input file unused since linking not done
gxx -v -Zwin32 -O3 -m486 -o prog.tmp prog.o
Reading specs from e:/dj/rsxntdj/lib\specs
gcc version 2.7.2.1
 e:\dj/bin\ld.exe -Le:/dj/rsxntdj/lib/all -o prog.tmp
e:/dj/rsxntdj/lib\crt0win.
o -Le:/dj/rsxntdj/lib\st -Le:/dj/rsxntdj/lib -Le:\dj/lib prog.o -lgpp
-lstdcx -l
m -Trsxnt.lnk -lalias -lgcc -lmain -lstati -lc -lc_app -lc -lgcc -lemx
-lemx2 -l
krn32 -lusr32 -lgdi32
e:\dj/lib/libgpp.a(iostream.o)(.text+0xa67):iostream.cc: undefined
reference to `__dj_ctype_flags'
e:\dj/lib/libgpp.a(iostream.o)(.text+0xe2b):iostream.cc: undefined
reference to `__dj_ctype_flags'
e:\dj/lib/libgpp.a(iostream.o)(.text+0xf08):iostream.cc: undefined
reference to `__dj_ctype_flags'
e:\dj/lib/libgpp.a(iostream.o)(.text+0xf50):iostream.cc: undefined
reference to `__dj_ctype_flags'
e:\dj/lib/libgpp.a(iostream.o)(.text+0xf92):iostream.cc: undefined
reference to `__dj_ctype_flags'
e:\dj/lib/libgpp.a(iostream.o)(.text+0x1ecf):iostream.cc: more undefined
references to '__dj_ctype_flags' follow
e:\dj/lib/libgpp.a(iostream.o)(.text+0x2052):iostream.cc: undefined
reference to `__dj_stdout'
e:\dj/lib/libgpp.a(iostream.o)(.text+0x205c):iostream.cc: undefined
reference to `__dj_stderr'
e:\dj/lib/libgpp.a(stdstrbu.o)(.data+0x130):stdstrbufs.cc: undefined
reference to `__dj_stdin'
e:\dj/lib/libgpp.a(stdstrbu.o)(.data+0x180):stdstrbufs.cc: undefined
reference to `__dj_stdout'
e:\dj/lib/libgpp.a(stdstrbu.o)(.data+0x1d0):stdstrbufs.cc: undefined
reference to `__dj_stderr'
e:\dj/lib/libgpp.a(stdiostr.o)(.text+0x323):stdiostream.cc: undefined
reference to `fileno'
e:\dj/lib/libgpp.a(stdiostr.o)(.text+0x398):stdiostream.cc: undefined
reference to `getc'
e:\dj/lib/libgpp.a(floatcon.o)(.text+0x1757):floatconv.c: undefined
reference to `__dj_huge_val'
e:\dj/lib/libgpp.a(iovfscan.o)(.text+0x63):iovfscanf.c: undefined
reference to `__dj_ctype_flags'
e:\dj/lib/libgpp.a(iovfscan.o)(.text+0x98):iovfscanf.c: undefined
reference to `__dj_ctype_flags'
e:\dj/lib/libgpp.a(iovfscan.o)(.text+0x4d6):iovfscanf.c: undefined
reference to `__dj_ctype_flags'
e:\dj/lib/libgpp.a(iovfscan.o)(.text+0x54c):iovfscanf.c: undefined
reference to `__dj_ctype_flags'
e:\dj/lib/libgpp.a(iovfscan.o)(.text+0x5c5):iovfscanf.c: undefined
reference to `__dj_ctype_flags'
e:\dj/lib/libgpp.a(iovfscan.o)(.text+0x816):iovfscanf.c: more undefined
references to `__dj_ctype_flags' follow
make.exe: *** [prog.exe] Error 1

------------------------------------------
Again, it compiles without the 'cout' line, but not with it.

*sigh*  I don't know enough about command-line compiling yet, and I'm
probably doing something silly, maybe in the Makefile.  I've checked the
installations many times over, used DJVERIFY 0.33a, and compiled other
C/++ programs fine.

Thanks a lot for any help!

-- 
seismic AT geocities DOT com
Lucidia: http://www.geocities.com/TimesSquare/Alley/4842/index.html

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019