- 论坛徽章:
- 0
|
呵呵,wget和curl,axel这种工具,最终会生成一个提供给用户的Exe
但是,不可避免会有多个main,因为有些是用于测试的,比如axel中search.c中就是这样的,但是他们是一般是不会与Axel的main冲突的,因为search.c中的main是用宏定义来声明的,要不然的话,如果.o链接进text.o中,编译器会报错的,多个main。
另外一点就是,确实是想编译多个工具,但是这多个c文件生成的.o文件是不会link到一起的。
楼主不妨按照我说的第一点去分析下不同main函数的作用,找找define宏是干啥的。
比如axel的search.c中这个
- #ifdef STANDALONE
- int main( int argc, char *argv[] )
- {
- conf_t conf[1];
- search_t *res;
- int i, j;
-
- if( argc != 2 )
- {
- fprintf( stderr, "Incorrect amount of arguments\n" );
- return( 1 );
- }
-
- conf_init( conf );
-
- res = malloc( sizeof( search_t ) * ( conf->search_amount + 1 ) );
- memset( res, 0, sizeof( search_t ) * ( conf->search_amount + 1 ) );
- res->conf = conf;
-
- i = search_makelist( res, argv[1] );
- if( i == -1 )
- {
- fprintf( stderr, "File not found\n" );
- return( 1 );
- }
- printf( "%i usable mirrors:\n", search_getspeeds( res, i ) );
- search_sortlist( res, i );
- for( j = 0; j < i; j ++ )
- printf( "%-70.70s %5i\n", res[j].url, res[j].speed );
-
- return( 0 );
- }
- #endif
复制代码 |
|