Mail Archives: djgpp/1996/06/16/22:21:01
I an new to DJGPP and C/C++ in general. I downloaded djgpp 2.0 but it =
cannot compile my test examples. I don't know what's wrong, hope anybody =
help. all stuff with option -v are the following. Two similar examples =
give two different answers.
//myfile.cc
#include <iostream.h>
void main()
{
int a=3D10;
double d=3D10;
out<<"test\n";
out<<a<<" "<<d;
return 0;
}
>gcc -v -o mf myfile.cc
Reading specs from c:/gnu/lib\specs
gcc version 2.7.2
c:/gnu/bin\cpp.exe -lang-c++ -v -undef -D__GNUC__=3D2 -D__GNUG__=3D2 =
-D__cplusplus
-D__GNUC_MINOR__=3D7 -Dunix -Di386 -DGO32 -DMSDOS -DDJGPP=3D2 =
-DDJGPP_MINOR=3D0 -D__un
ix__ -D__i386__ -D__GO32__ -D__MSDOS__ -D__DJGPP__=3D2 =
-D__DJGPP_MINOR__=3D0 -D__uni
x -D__i386 -D__GO32 -D__MSDOS -D__DJGPP=3D2 -D__DJGPP_MINOR=3D0 =
myfile.cc c:/gnu/tmp
\ccbaaaaa
GNU CPP version 2.7.2 (80386, BSD syntax)
#include "..." search starts here:
#include <...> search starts here:
c:/gnu/lang/cxx
c:/gnu/include
c:/gnu/contrib/grx20/include
/usr/local/lib/g++-include
/usr/local/include
/usr/local/go32/include
/usr/local/lib/gcc-lib/go32/2.7.2/include
/usr/include
End of search list.
c:/gnu/bin\cc1plus.exe c:/gnu/tmp\ccbaaaaa -fno-strength-reduce =
-fno-strength-r
educe -quiet -dumpbase myfile.cc -version -o c:/gnu/tmp\cccaaaaa
GNU C++ version 2.7.2 (80386, BSD syntax) compiled by GNU C version =
2.7.2.
myfile.cc: In function `int main(...)':
myfile.cc:6: `out' undeclared (first use this function)
myfile.cc:6: (Each undeclared identifier is reported only once
myfile.cc:6: for each function it appears in.)
---------------------------------------
---------------------------------------
//myfile.cpp:
#include <iostream.h>
class my{
int a;
public:
my(int x);
void show();
};
my::my(int x)
{
cout<<"constructor\n";
a=3Dx;
}
void my::show()
{
cout<<a<<"\n";
}
main()
{
my ob(4);
ob.show();
return 0;
}
C:\GNU\TMP>gcc -v myfile.cpp
Reading specs from c:/gnu/lib\specs
gcc version 2.7.2
c:/gnu/bin\cpp.exe -lang-c++ -v -undef -D__GNUC__=3D2 -D__GNUG__=3D2 =
-D__cplusplus
-D__GNUC_MINOR__=3D7 -Dunix -Di386 -DGO32 -DMSDOS -DDJGPP=3D2 =
-DDJGPP_MINOR=3D0 -D__un
ix__ -D__i386__ -D__GO32__ -D__MSDOS__ -D__DJGPP__=3D2 =
-D__DJGPP_MINOR__=3D0 -D__uni
x -D__i386 -D__GO32 -D__MSDOS -D__DJGPP=3D2 -D__DJGPP_MINOR=3D0 =
myfile.cpp c:/gnu/tm
p\ccbaaaaa
GNU CPP version 2.7.2 (80386, BSD syntax)
#include "..." search starts here:
#include <...> search starts here:
c:/gnu/lang/cxx
c:/gnu/include
c:/gnu/contrib/grx20/include
/usr/local/lib/g++-include
/usr/local/include
/usr/local/go32/include
/usr/local/lib/gcc-lib/go32/2.7.2/include
/usr/include
End of search list.
c:/gnu/bin\cc1plus.exe c:/gnu/tmp\ccbaaaaa -fno-strength-reduce =
-fno-strength-r
educe -quiet -dumpbase myfile.cc -version -o c:/gnu/tmp\cccaaaaa
GNU C++ version 2.7.2 (80386, BSD syntax) compiled by GNU C version =
2.7.2.
c:/gnu/bin\as.exe -o c:/gnu/tmp\ccdaaaaa c:/gnu/tmp\cccaaaaa
c:/gnu/bin\ld.exe c:/gnu/lib\crt0.o -Lc:/gnu/lib c:/gnu/tmp\ccdaaaaa =
-Tdjgpp.ln
k -lgcc -lc -lgcc
myfile.cc(.text+0x1d): undefined reference to `cout'
myfile.cc(.text+0x22): undefined reference to `ostream::operator<<(char =
const *)'
myfile.cc(.text+0x4d): undefined reference to `cout'
myfile.cc(.text+0x52): undefined reference to `ostream::operator<<(int)'
myfile.cc(.text+0x5d): undefined reference to `ostream::operator<<(char =
const *'
- Raw text -