警告:以前没有“使用”原型

时间:2013-03-29 12:45:06

标签: c

int /usage( const char* name )
{
   fprintf( stderr, "usage: %s\n", name );

   fprintf( stderr, "\t[ -h a | c ]\n"
            "\t\thealthcheck - amf or comp invoked\n" );
   fprintf( stderr, "\t[ -e a | s | q | r | p | x ]\n"
            "\t\terror assignment (x error all)\n" );
   fprintf( stderr, "\t[ -f invocation_number ]\n"
            "\t\tfail specified healthcheck invocation\n" );
   fprintf( stderr, "\t[ -i a | s | q | r | p | x ]\n"
            "\t\tignore assignment (x ignore all)\n" );
   fprintf( stderr, "\t[ -m b]\n"
                    "\t\tpassive monitoring - start\n");
   fprintf( stderr, "\t[ -p proxied ]\n"
            "\t\tregister for proxied\n" );
   fprintf( stderr, "\t[ -s ]\n"
            "\t\tsuppress component output\n" );
   fprintf( stderr, "\t[ -z ]\n"`enter code here`
            "\t\tsuppress component registration\n" );
   return 1;
}

请帮我摆脱那个警告。正如我几天所面对的那样。还有更多相同类型的警告。提前感谢你。

1 个答案:

答案 0 :(得分:1)

你的函数签名中有一个迷路\,它不能存在:

int usage( const char* name )
{
   fprintf( stderr, "usage: %s\n", name );

   fprintf( stderr, "\t[ -h a | c ]\n"
            "\t\thealthcheck - amf or comp invoked\n" );
   fprintf( stderr, "\t[ -e a | s | q | r | p | x ]\n"
            "\t\terror assignment (x error all)\n" );
   fprintf( stderr, "\t[ -f invocation_number ]\n"
            "\t\tfail specified healthcheck invocation\n" );
   fprintf( stderr, "\t[ -i a | s | q | r | p | x ]\n"
            "\t\tignore assignment (x ignore all)\n" );
   fprintf( stderr, "\t[ -m b]\n"
                    "\t\tpassive monitoring - start\n");
   fprintf( stderr, "\t[ -p proxied ]\n"
            "\t\tregister for proxied\n" );
   fprintf( stderr, "\t[ -s ]\n"
            "\t\tsuppress component output\n" );
   fprintf( stderr, "\t[ -z ]\n"
            "\t\tsuppress component registration\n" );
   return 1;
}