#include <my_global.h>
#include <mysql.h>
#include <my_sys.h>static char* opt_host_name = NULL;
static char* opt_user_name = "cube@localhost";
static char* opt_user_password = NULL;
static unsigned int opt_port_num = 0;
static char* opt_socket_name = NULL;
static char* opt_db_name = "library";
static unsigned int opt_flags = 0;
static MYSQL* conn;int main(int argc,char* argv[]) {
        MY_INIT(argv[0]);
        if(mysql_library_init(0,NULL,NULL)) {
                fprintf(stderr,"mysql_library_init() failed\n");
                return 1;
        }        if( (conn = mysql_init(NULL)) == NULL) {
                fprintf(stderr,"mysql_init() failed\n");
                return 1;
        }
        if( (mysql_real_connect(conn,opt_host_name,opt_user_name,opt_user_password,
                opt_db_name,opt_port_num,opt_socket_name,opt_flags)) == NULL) {
                fprintf(stderr,"Connect failed\n");
                mysql_close(conn);
                return 1;
        }
        mysql_close(conn);
        mysql_library_end();
        return 0;
}test.o: In function `main':                                                                                                             
test.c:(.text+0x19): undefined reference to `my_progname'                                                                               
collect2: error: ld returned 1 exit status问题应该在MY_INIT(),可以在my_sys.h中找到。