E
edwardzyang
I am running Windows XP with cygwin with gcc 3.4.4-1 and gdb
20060706-2. I compiled this very simple program:
#include <iostream>
using namespace std;
int main(int argc, char (*(argv[])) ) {
int max; // number to count to
if (argc == 1) {
// print to 100
max = 100;
} else {
// convert first argument to integer, print to that
max = atoi(argv[1]);
}
for (int i = 0; i <= max; i++) {
cout << i << "\n";
}
return 0;
}
....using the command:
$ g++ -g -o printNumbers.exe printNumbers.cpp
When I run `gdb printNumbers.exe`, things start off fine:
GNU gdb 6.5.50.20060706-cvs (cygwin-special)
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and
you ar
welcome to change it and/or distribute copies of it under certain
condition
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for
details.
This GDB was configured as "i686-pc-cygwin"...
....but when I actually try to run the executable, I get this error:
(gdb) run
Starting program: ~/C++/exercises/printNumbers.exe
Error creating process ~/C++/exercises/printNumbers.exe, (error 193).
Error 193 is ERROR_BAD_EXE_FORMAT, but this cryptic error code does not
give me much information on how to resolve the problem. Note that
outside the debugger, both inside and outside of cygwin, the program
runs fine.
I have tried compiling the program several times using different
distributions of the g++ compiler (dev-cpp and mingw) inside and
outside of cygwin, but all with the same result. I have also tried
running gdb inside and outside of cygwin.
Running 'g++ -dumpmachine' returns "i686-pc-cygwin", so the
architectures appear to match up and should not pose a problem.
I am confounded, and not having ever used a debugger before (I hail
from PHP) doesn't help very much. Help much appreciated!
P.S. I realize debugging is not directly related to comp.lang.c++,
however, it probably is an essential part of any C++ developer's
toolkit, and also the more relevant gnu.gdb is read-only.
20060706-2. I compiled this very simple program:
#include <iostream>
using namespace std;
int main(int argc, char (*(argv[])) ) {
int max; // number to count to
if (argc == 1) {
// print to 100
max = 100;
} else {
// convert first argument to integer, print to that
max = atoi(argv[1]);
}
for (int i = 0; i <= max; i++) {
cout << i << "\n";
}
return 0;
}
....using the command:
$ g++ -g -o printNumbers.exe printNumbers.cpp
When I run `gdb printNumbers.exe`, things start off fine:
GNU gdb 6.5.50.20060706-cvs (cygwin-special)
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and
you ar
welcome to change it and/or distribute copies of it under certain
condition
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for
details.
This GDB was configured as "i686-pc-cygwin"...
....but when I actually try to run the executable, I get this error:
(gdb) run
Starting program: ~/C++/exercises/printNumbers.exe
Error creating process ~/C++/exercises/printNumbers.exe, (error 193).
Error 193 is ERROR_BAD_EXE_FORMAT, but this cryptic error code does not
give me much information on how to resolve the problem. Note that
outside the debugger, both inside and outside of cygwin, the program
runs fine.
I have tried compiling the program several times using different
distributions of the g++ compiler (dev-cpp and mingw) inside and
outside of cygwin, but all with the same result. I have also tried
running gdb inside and outside of cygwin.
Running 'g++ -dumpmachine' returns "i686-pc-cygwin", so the
architectures appear to match up and should not pose a problem.
I am confounded, and not having ever used a debugger before (I hail
from PHP) doesn't help very much. Help much appreciated!
P.S. I realize debugging is not directly related to comp.lang.c++,
however, it probably is an essential part of any C++ developer's
toolkit, and also the more relevant gnu.gdb is read-only.