Date: Mon, 25 May 92 17:17:11 +0300 From: tlehtone AT cs DOT Helsinki DOT FI (Tapio Lehtonen) To: djgpp AT sun DOT soe DOT clarkson DOT edu Subject: Problems Status: O The following program compiles but does not link. --getopt.cc-- #include #include int main (int argc, char* argv[]) { GetOpt getopt(argc, argv, "abc"); int opt; opt=getopt(); cout << "Opt on nyt " << opt << '\n'; } --end of file--- --output of gcc -v ---- Reading specs from c:/djgpp/lib/specs gcc version 2.1 c:/djgpp/bin/cpp.exe -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dunix -Di386 -D__unix__ -D__i386__ -D__unix -D__i386 -D__GO32__ -D__MSDOS__ -DGO32 -DMSDOS -noprecomp testgeto.cc /tmp/cc000042.i GNU CPP version 2.1 (80386, BSD syntax) c:/djgpp/bin/cc1plus.exe /tmp/cc000042.i -quiet -dumpbase testgeto.cc -version -o /tmp/cc000042.s GNU C++ version 2.1 (80386, BSD syntax) compiled by GNU C version 2.1. c:/djgpp/bin/as.exe -o testgeto.o /tmp/cc000042.s c:/djgpp/bin/ld.exe c:/djgpp/lib/crt0.o -Lc:/djgpp/lib/ -Lc:/djgpp/lib/ testgeto.o -lgcc -lc -lgcc alloca.o: Undefined symbol _xmalloc referenced from text segment --end of output---- Is it possible to use the class GetOpt somehow? Another problem concerns for loop. --excerpt of code---- cout << "Veikkaustietokanta tarkistuksen vuoksi\n\n"; cout << "vfirst=" << vfirst << '\n'; /*This code writes veikkaaja=0x0 and segmentation violates. for (veikkaaja=vfirst; veikkaaja != NULL; veikkaaja=veikkaaja->next); { cout << "veikkaaja=" << veikkaaja << '\n'; if (veikkaaja!=NULL) cout << "veikkaaja->next=" << veikkaaja->next << '\n'; tulostaveikkaaja(cout, veikkaaja); }//endfor */ /*This while -version works OK*/ veikkaaja=vfirst; while (veikkaaja != NULL) { cout << "veikkaaja=" << veikkaaja << '\n'; if (veikkaaja!=NULL) cout << "veikkaaja->next=" << veikkaaja->next << '\n'; tulostaveikkaaja(cout, veikkaaja); veikkaaja=veikkaaja->next; } cout << "\nOnnellinen voittaja on " << veiknimi << '\n'; --end excerpt--- Seems that the for-loop sets veikkaaja=NULL, but the equivalent while version of the for construct works. Third problem is 387 emulation. Using djgpp 1.05 the following program ran, but produced incorrect results. Using 2.1 produces segmentation violation. Perhaps there is something wrong with some functions in math.h, or the 387 emulation does not work perfectly. --power.cc--- #include #include //extern float pow(float x, int i); //extern float pow(float c, float y); int main() { for (int i = 0; i<20; i++) cout << pow(2,i) << '\t' << pow((float) 2, (float) i) << '\n'; } --end of file--- I have an IBM PS/2 model 80, DOS 4. -- Tapio Lehtonen PHONE + 358 0 7084206 Room A417 Dept. Comp. Sci., Univ. of Helsinki TELEX 122785 TSK SF FAX 708 4441 Teollisuuskatu 23, SF-00510 Helsinki INTERNET tlehtone AT cs DOT Helsinki DOT FI Finland TLEHTONEN AT FINUH HYLK::TLEHTONEN