Weird parsing error message from AimsApplication
Posted: Wed Nov 30, 2005 3:14 pm
When compiling the following code:
and calling it with a wrong input argument name, I get the following weird error message:
What's more, I get the error only if the faulty parameter appears before all expected input arguments are parsed -- in the example above, no error is given if -m is set after -n. I did not fully investigate the problem, but it seems to me that the error stems from using plain type arguments -- in any case, the error message is different when Reader's are involved.
Pascal
Code: Select all
#include <aims/getopt/getopt2.h>
#include <aims/data/data_g.h>
#include <aims/io/io_g.h>
using namespace aims;
using namespace carto;
using namespace std;
int main(int argc, const char **argv)
{
try
{
int n;
AimsApplication application( argc, argv, "weird" );
application.addOption( n, "-n", "an integer" );
application.initialize();
}
catch( user_interruption &e ) {}
catch( std::exception &e ) { cerr << argv[ 0 ] << ": " << e.what() << endl; }
return 0;
}
Code: Select all
% bin/AimsTemplate -m 3 -n 3
bin/AimsTemplate: -m is no a valid integer
Pascal