Mail Archives: djgpp/2003/07/23/06:42:38
Hi
I have neither experience with DJGPP nor (much) with C++
in general but I wanted to run a small test program to
test the speed of execution in C/C++ with another application
under Windows.
However, I seem to have fallen at the first hurdle..
It is necessary for the task in question to use containers and
I had wanted to use vectors. However I cannot seem to interpret
the behaviour of the following small program:
#include <iostream>
#include <vector>
using namespace std;
int main() {
vector<int> *demand;
for (int i=0; i<10; ++i)
{
demand->push_back(7);
}
for (vector<int>::iterator it=demand->begin(); it!=demand->end();
++it)
{
cout << *it << "\n";
}
return 0;
}
I had hoped it would print 10 7s on the screen. Instead it sends about
800 lines of ints follow by the 10 7s.
Either (a) I've haven't understood some aspect of the use of
vectors/pointers
or (b) there's some issue with DJGPP and I would be very grateful
of any hints.
In case it might be the latter, I'm using gxx under windows2000, and
gxx -v produces
Reading specs from c:/djgpp/lib/gcc-lib/djgpp/3.23/specs
Configured with: /devel/gnu/gcc/3.2/gnu/gcc-3.23/configure
i586-pc-msdosdjgpp --prefix=/dev/env/DJDIR --disable-nls
Thread model: single
gcc version 3.2.3
c:/djgpp/lib/gcc-lib/djgpp/3.23/collect2.exe c:/djgpp/lib/crt0.o
-Lc:/djgpp/lib -Lc:/djgpp/lib/gcc-lib/djgpp/3.23 -Lc:/djgpp/bin
-Lc:/djgpp/lib -Lc:/djgpp/lib/gcc-lib/djgpp/3.23/../../.. -lstdcxx -lm
-lgcc -lc -lgcc -Tdjgpp-x.djl
c:/djgpp/lib/crt0.o(.data+0xc2):crt0.s: undefined reference to `_main'
c:/djgpp/lib/libc.a(crt1.o)(.text+0x404):crt1.c: undefined reference
to `_main'
collect2: ld returned 1 exit status
Many thanks for any help,
Tom
- Raw text -