Reputation: 241
I am compiling a test case for some code I have written with g++ and trying to debug it with gdb on the command line. The code compiles without errors or warnings, but when I launch my executable with gdb I get the following error:
Assertion failed: (g.numPlayers>0 && g.numPlayers<=MAXPLAYERS && cin), function readScenario, file p3t3.cpp, line 141.
I am using the same exact input arguments with gdb as I am when I run the compiled program normally. Is there a reason something can compile without problems and yet throw an error within gdb?
Upvotes: 0
Views: 902
Reputation: 8491
If you need to pass command-line arguments to your program, then you either need to use
$ gdb --args ./program arg1 arg2
or
$ gdb ./program
...
(gdb) run arg1 arg2
Upvotes: 1