PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.databases.mysql > MySQL C API Problem with struct my_option
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
MySQL C API Problem with struct my_option

Réponse
 
LinkBack Outils de la discussion
Vieux 21/12/2007, 10h07   #1
crybaby
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut MySQL C API Problem with struct my_option

I have installed mysql-devel 6.0.3-0.glibc23.i386 on my Fedora 6 box.

gptr seems to be a problem when I compile my C client code with mysql-
devel 6.0.3-0.

I have taken the template code from book MySQL by Paul BuBois, Chapter
6 Section: Processing Command-Line Arguments, Accessing Option File
Contents.

Here is the html format of Chapter6 pdf code:
http://72.14.205.104/search?q=cache:...&ct=clnk&cd=3&

static struct my_option my_opts[] = /* option information
structures */
{
{"", '?', "Display this and exit",
NULL, NULL, NULL,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Host to connect to",
(gptr *) &opt_host_name, NULL, NULL,
GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"password", 'p', "Password",
(gptr *) &opt_password, NULL, NULL,
GET_STR_ALLOC, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"port", 'P', "Port number",
(gptr *) &opt_port_num, NULL, NULL,
GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"socket", 'S', "Socket path",
(gptr *) &opt_socket_name, NULL, NULL,
GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"user", 'u', "User name",
(gptr *) &opt_user_name, NULL, NULL,
GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ NULL, 0, NULL, NULL, NULL, NULL, GET_NO_ARG, NO_ARG, 0, 0, 0, 0,
0, 0 }
};


make
gcc -c -I/usr/include/mysql connect2.c
connect2.c:37: error: 'gptr' undeclared here (not in a function)
connect2.c:37: error: expected expression before ')' token
connect2.c:39: warning: braces around scalar initializer
connect2.c:39: warning: (near initialization for 'my_opts[1].typelib')
connect2.c:39: warning: initialization from incompatible pointer type
connect2.c:39: warning: excess elements in scalar initializer
connect2.c:39: warning: (near initialization for 'my_opts[1].typelib')
connect2.c:39: warning: excess elements in scalar initializer
connect2.c:39: warning: (near initialization for 'my_opts[1].typelib')
connect2.c:40: error: expected expression before ')' token
connect2.c:40: warning: excess elements in scalar initializer
connect2.c:40: warning: (near initialization for 'my_opts[1].typelib')
connect2.c:41: warning: excess elements in scalar initializer
connect2.c:41: warning: (near initialization for 'my_opts[1].typelib')
connect2.c:42: warning: braces around scalar initializer
connect2.c:42: warning: (near initialization for 'my_opts[1].typelib')
connect2.c:42: warning: initialization from incompatible pointer type
connect2.c:42: warning: excess elements in scalar initializer
connect2.c:42: warning: (near initialization for 'my_opts[1].typelib')
connect2.c:42: warning: excess elements in scalar initializer
connect2.c:42: warning: (near initialization for 'my_opts[1].typelib')
connect2.c:43: error: expected expression before ')' token
connect2.c:43: warning: excess elements in scalar initializer
connect2.c:43: warning: (near initialization for 'my_opts[1].typelib')
connect2.c:44: warning: excess elements in scalar initializer
connect2.c:44: warning: (near initialization for 'my_opts[1].typelib')
connect2.c:45: warning: braces around scalar initializer
connect2.c:45: warning: (near initialization for 'my_opts[1].typelib')
connect2.c:45: warning: initialization from incompatible pointer type
connect2.c:45: warning: excess elements in scalar initializer
connect2.c:45: warning: (near initialization for 'my_opts[1].typelib')
connect2.c:45: warning: excess elements in scalar initializer
connect2.c:45: warning: (near initialization for 'my_opts[1].typelib')
connect2.c:46: error: expected expression before ')' token
connect2.c:46: warning: excess elements in scalar initializer
connect2.c:46: warning: (near initialization for 'my_opts[1].typelib')
connect2.c:47: warning: excess elements in scalar initializer
connect2.c:47: warning: (near initialization for 'my_opts[1].typelib')
connect2.c:48: warning: braces around scalar initializer
connect2.c:48: warning: (near initialization for 'my_opts[1].typelib')
connect2.c:48: warning: initialization from incompatible pointer type
connect2.c:48: warning: excess elements in scalar initializer
connect2.c:48: warning: (near initialization for 'my_opts[1].typelib')
connect2.c:48: warning: excess elements in scalar initializer
connect2.c:48: warning: (near initialization for 'my_opts[1].typelib')
connect2.c:49: error: expected expression before ')' token
connect2.c:49: warning: excess elements in scalar initializer
connect2.c:49: warning: (near initialization for 'my_opts[1].typelib')
connect2.c:50: warning: excess elements in scalar initializer
connect2.c:50: warning: (near initialization for 'my_opts[1].typelib')
connect2.c:51: warning: braces around scalar initializer
connect2.c:51: warning: (near initialization for 'my_opts[1].typelib')
connect2.c:51: warning: excess elements in scalar initializer
connect2.c:51: warning: (near initialization for 'my_opts[1].typelib')
connect2.c:51: warning: excess elements in scalar initializer
connect2.c:51: warning: (near initialization for 'my_opts[1].typelib')
connect2.c:51: warning: excess elements in scalar initializer
connect2.c:51: warning: (near initialization for 'my_opts[1].typelib')
connect2.c:51: warning: excess elements in scalar initializer
connect2.c:51: warning: (near initialization for 'my_opts[1].typelib')
connect2.c:51: warning: excess elements in scalar initializer
connect2.c:51: warning: (near initialization for 'my_opts[1].typelib')
connect2.c:51: warning: excess elements in scalar initializer
connect2.c:51: warning: (near initialization for 'my_opts[1].typelib')
connect2.c:51: warning: excess elements in scalar initializer
connect2.c:51: warning: (near initialization for 'my_opts[1].typelib')
connect2.c:51: warning: excess elements in scalar initializer
connect2.c:51: warning: (near initialization for 'my_opts[1].typelib')
connect2.c:51: warning: excess elements in scalar initializer
connect2.c:51: warning: (near initialization for 'my_opts[1].typelib')
connect2.c:51: warning: excess elements in scalar initializer
connect2.c:51: warning: (near initialization for 'my_opts[1].typelib')
connect2.c:51: warning: excess elements in scalar initializer
connect2.c:51: warning: (near initialization for 'my_opts[1].typelib')
connect2.c:51: warning: excess elements in scalar initializer
connect2.c:51: warning: (near initialization for 'my_opts[1].typelib')
connect2.c:51: warning: excess elements in scalar initializer
connect2.c:51: warning: (near initialization for 'my_opts[1].typelib')
connect2.c:51: warning: excess elements in scalar initializer
connect2.c:51: warning: (near initialization for 'my_opts[1].typelib')
connect2.c:52: error: invalid initializer

any is appreciated. thanks.
Joe
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 05h04.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,10962 seconds with 9 queries