Mail Archives: cygwin/1999/09/17/09:29:38
--=_-=_-EEFNFDJNGIGDJAAA
Content-Type: text/plain; charset=us-ascii
Content-Length: 1174
Content-Transfer-Encoding: 7bit
OS) NT4 SP5
Cygwin ver) 20.1
GCC ver) 2.91.57
Watcom ver) 11.0b
STL) SGI port, 3.12.3
I wrote the attached program which uses, strings, vectors and the "Unix"
function, getch. It compiled and ran correctly using the Watcom comiler, so
I am pretty sure that everything in the program is correct. I also copied most
of the syntax from Stroustrup's "The C++ Programming Language", 3rd edition,
chapters 20 & 21, so most (all?) of the functions and syntax for the STL
should be correct.
I can't get the program to compile with Cygnus-GCC or Cygnus-G++. I have tried
the following command lines:
gcc -mng-cygwin -o mypg mypg.cpp
g++ -mno-cygwin -o mypg mypg.cpp
g++ -mno-cygwin -o mypg mypg.cpp
gcc -mno-cygwin -o mypg -I//d/STLport-3.12.3/stl mypg.cpp
g++ -mno-cygwin -o mypg -I//d/STLport-3.12.3/stl mypg.cpp
gcc -mno-cygwin -o mypg -I//d/cygnus/include/g++-3 mypg.cpp
g++ -mno-cygwin -o mypg -I//d/cygnus/include/g++-3 mypg.cpp
None of these work.
Could someone show me how to get this program to compile?
Thanks in Advance,
Clark Sims
--== Sent via Deja.com http://www.deja.com/ ==--
Share what you know. Learn what you don't.
--=_-=_-EEFNFDJNGIGDJAAA
Content-Type: text/plain; charset=us-ascii; name="mypg.cpp"
Content-Length: 1126
Content-Transfer-Encoding: 7bit
#include <iostream.h>
#include <stdio.h>
#include <string>
#include <vector.h>
#include <conio.h>
class UsageError {};
void usage()
{
cout << "usage: mypg [-p=25]" << endl;
throw UsageError();
}
int main( int argc, const char* argv[])
{
int p=25;
if (argc > 1)
{
if (argc!=2 || memcmp( argv[1], "-p=", 3) != 0)
{
usage();
}
p = atol( argv[1]+3);
if (p<=0)
{
cout << "p = " << p << " must be > 0" << endl;
usage();
}
}
char c;
string input;
vector<string> pg(p);
long i = 0;
do {
input = "";
while( (c=cin.get())!='\n' && cin)
{
if (c != '\r')
input += c;
}
if (cin)
{
pg[i] = input;
i++;
}
if (i == p || !cin)
{
long j;
for (j=0;j<i;j++) {
cout << pg[j] << endl;
}
cout.flush();
i = 0;
if (!cin) {
fflush( NULL);
getch();
}
}
} while (cin);
return 0;
}
--=_-=_-EEFNFDJNGIGDJAAA
Content-Type: text/plain; charset=us-ascii
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
--=_-=_-EEFNFDJNGIGDJAAA--
- Raw text -