Mail Archives: djgpp/1995/10/02/09:18:42
Hi all! In short, I installed djgpp and it compiled hello.c from the
samples directory just fine, but when I try a simple c++ program, I get
the following error:
myfirst.cc(.text+0x2e): undefined reference to `cout'
myfirst.cc(.text+0x33): undefined reference to `ostream::operator<<(char const *
)'
myfirst.cc(.text+0x40): undefined reference to `cout'
myfirst.cc(.text+0x45): undefined reference to `ostream::operator<<(char const *
)'
I am running djgpp 1.12maint3. I am using a 486dx33, 8MB RAM, Win95,
MS-DOS window (command line).
In long,
I unzipped the following files in the E:\DJGPP directory:
BCCGRX12.ZIP BNU252BN.ZIP BNU252DC.ZIP BNU252S1.ZIP BNU252S2.ZIP
BNU252S3.ZIP BNU252S4.ZIP BSN122BN.ZIP BSN122DC.ZIP BSN122SR.ZIP
CBGRD103.ZIP CBGRF103.ZIP CBGRX103.ZIP DIF26BN.ZIP DIF26DC.ZIP
DIF26SR.ZIP DJDEV112.ZIP DJDOC112.ZIP DJEMU112.ZIP DJEOE112.ZIP
DJLGR112.ZIP DJLSR112.ZIP DJSRC112.ZIP DJTST112.ZIP FAQ102.ZIP
FLX247BN.ZIP FLX247DC.ZIP FLX247SR.ZIP GCC263BN.ZIP GCC263DC.ZIP
GCC263RM.ZIP GCC263S1.ZIP GCC263S2.ZIP GCC263S3.ZIP GCC263S4.ZIP
GCC263S5.ZIP GCC263S6.ZIP GDB412BN.ZIP GDB412DC.ZIP GDB412S1.ZIP
GDB412S2.ZIP GDB412S3.ZIP GDB412S4.ZIP GPP263.ZIP GRX103M1.ZIP
GZP124BN.ZIP GZP124DC.ZIP GZP124SR.ZIP LDBG102.ZIP LDBG102D.ZIP
LGP262BN.ZIP LGP262DC.ZIP LGP262SR.ZIP MAK371BN.ZIP MAK371DC.ZIP
MAK371SR.ZIP PAT21BN.ZIP PAT21DC.ZIP PAT21SR.ZIP PDC22BN.ZIP
SED118BN.ZIP SED118SR.ZIP TXI310BN.ZIP TXI310DC.ZIP TXI310SR.ZIP
WMEMU112.ZIP
I added E:\DJGPP\BIN to my path, added the SET DJGPP=E:\DJGPP\DJGPP.ENV
variable setting to autoexec.bat, and ensured that the FILES and SHELL
settings in config.sys were sufficient. I then rebooted.
I ran go32 and it was version 1.12, so I applied all 4 maintenance
release patches:
DJ112M1.ZIP DJ112M2.ZIP DJ112M3.ZIP DJ112M4.ZIP
Running each patch batch file was successful, and go32 went from
version 1.12 to 1.12 patch level 3.
Since patch level 1 was supposed to change bnu24bn.zip, lgp260bn.zip,
and lgp260dc.zip, and I started with versions higher, I reunzipped
(overwriting) the following:
BNU252BN.ZIP BNU252DC.ZIP BNU252S1.ZIP BNU252S2.ZIP BNU252S3.ZIP
BNU252S4.ZIP LGP262BN.ZIP LGP262DC.ZIP LGP262SR.ZIP
I ran the batch program E:\DJGPP\SAMPLES\HELLO\TRYIT.BAT and the hello.c
code compiled without any problems and produced the following output:
go32 version 1.12.maint3 Copyright (C) 1994 DJ Delorie
Hello! This is the test program.
(this only contains c syntax, not c++ syntax)
I tried to compile the following source code (myfirst.cpp):
// myfirst.cpp--displays a message
#include <iostream.h> // a PREPROCESSOR directive
int main(void)
{
cout << "Come up and C++ me some time.";
cout << "\n";
return 0;
}
This is the result of compilation:
E:\DJGPP\SRC\cis_230\testbed1>gcc -v myfirst.cpp
Reading specs from e:/djgpp/lib\specs
gcc version 2.6.3
e:/djgpp/bin\cpp.exe -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplu
s -D__GNUC_MINOR__=6 -Dunix -Di386 -DGO32 -DMSDOS -D__unix__ -D__i386__ -D__GO32
__ -D__MSDOS__ -D__unix -D__i386 -D__GO32 -D__MSDOS myfirst.cpp e:/djgpp/tmp\cc0
08394
GNU CPP version 2.6.3 (80386, BSD syntax)
#include "..." search starts here:
#include <...> search starts here:
e:/djgpp/cplusinc
e:/djgpp/include
/usr/local/lib/g++-include
/usr/local/include
/usr/local/go32/include
/usr/local/lib/gcc-lib/go32/2.6.1/include
/usr/include
End of search list.
e:/djgpp/bin\cc1plus.exe e:/djgpp/tmp\cc008394 -quiet -dumpbase myfirst.cc -ver
sion -o e:/djgpp/tmp\cca08394
GNU C++ version 2.6.3 (80386, BSD syntax) compiled by GNU C version 2.6.3.
e:/djgpp/bin\as.exe -o e:/djgpp/tmp\ccb08394 e:/djgpp/tmp\cca08394
e:/djgpp/bin\ld.exe e:/djgpp/lib\crt0.o -Le:/djgpp/lib e:/djgpp/tmp\ccb08394 -l
gcc -lc -lgcc
myfirst.cc(.text+0x2e): undefined reference to `cout'
myfirst.cc(.text+0x33): undefined reference to `ostream::operator<<(char const *
)'
myfirst.cc(.text+0x40): undefined reference to `cout'
myfirst.cc(.text+0x45): undefined reference to `ostream::operator<<(char const *
)'
Please let me know what I should check or change to get c++ working.
Thanks!
----------------------------------------------------------------------
_ _
/ |_ ._ o _ /\ |_) _ _| _ _ ._ _ Software Engineer
\_| || |_> /--\o | \(_)(_|(_|(/_| _> car AT wwa DOT com
_|
- Raw text -