Hello Sir,
After we have read through the intro/12-c_maapi directory for creating our own C application file and executing it, we have written the C code for our database and tried to execute it by initiating the interaction with confd using the command “make all start”,but we have encountered with some errors as follows:
movie2.c: In function ‘cnct’:
movie2.c:38:40: error: ‘pass’ undeclared (first use in this function); did you mean ‘puts’?
if (maapi_authenticate(sock, user, pass, &groups[0], 10) == 1) {
^~
puts
movie2.c:38:40: note: each undeclared identifier is reported only once for each function it appears in
In file included from movie2.c:3:0:
movie2.c:43:31: error: ‘srcip’ undeclared (first use in this function)
&srcip, CONFD_PROTO_TCP);
^
…/include/confd_maapi.h:223:56: note: in definition of macro ‘maapi_start_user_session’
maapi_start_user_session3(s, user, ctx, groups, n, addr, 0, prot,
^~
movie2.c:42:51: warning: passing argument 4 of ‘maapi_start_user_session3’ from incompatible pointer type [-Wincompatible-pointer-types]
maapi_start_user_session(sock, user, context, groups, i,
^
…/include/confd_maapi.h:223:45: note: in definition of macro ‘maapi_start_user_session’
maapi_start_user_session3(s, user, ctx, groups, n, addr, 0, prot,
^~~~
…/include/confd_maapi.h:230:12: note: expected ‘const char *’ but argument is of type ‘char *’
extern int maapi_start_user_session3(int sock,
^~~~~~~~~
movie2.c: In function ‘readwrite’:
movie2.c:61:12: warning: implicit declaration of function ‘strtok’ [-Wimplicit-function-declaration]
if((tok= strtok(ibuf, DELIM)) == NULL) {
^~~~
movie2.c:61:10: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
if((tok= strtok(ibuf, DELIM)) == NULL) {
^
movie2.c:67:13: warning: implicit declaration of function ‘strcmp’ [-Wimplicit-function-declaration]
if(strcmp(tok, “get”)==0) {
^~~~
movie2.c:77:23: warning: passing argument 1 of ‘confd_pp_value’ from incompatible pointer type [-Wincompatible-pointer-types]
confd_pp_value(&id,&mc.keys[0]); // key of the table
^
In file included from movie2.c:2:0:
…/include/confd_lib.h:1075:12: note: expected ‘char *’ but argument is of type ‘int *’
extern int confd_pp_value(char *buf, int bufsiz, const confd_value_t *v);
^~~~~~
movie2.c:77:27: warning: passing argument 2 of ‘confd_pp_value’ makes integer from pointer without a cast [-Wint-conversion]
confd_pp_value(&id,&mc.keys[0]); // key of the table
^
In file included from movie2.c:2:0:
…/include/confd_lib.h:1075:12: note: expected ‘int’ but argument is of type ‘confd_value_t * {aka struct confd_value *}’
extern int confd_pp_value(char *buf, int bufsiz, const confd_value_t *v);
^~~~~~
movie2.c:77:8: error: too few arguments to function ‘confd_pp_value’
confd_pp_value(&id,&mc.keys[0]); // key of the table
^~~~~~
In file included from movie2.c:2:0:
…/include/confd_lib.h:1075:12: note: declared here
extern int confd_pp_value(char *buf, int bufsiz, const confd_value_t *v);
^~~~~~
movie2.c:79:52: warning: passing argument 4 of ‘maapi_get_str_elem’ makes integer from pointer without a cast [-Wint-conversion]
maapi_get_str_elem(sock, th, f_name, “/movie/actors/actor{%x}/ first_name”, &mc.keys[0]);
^~~~~~~~~~~~~~~
In file included from movie2.c:3:0:
…/include/confd_maapi.h:463:12: note: expected ‘int’ but argument is of type ‘char *’
extern int maapi_get_str_elem(int sock, int thandle, char *buf, int n,
^~~~~~~~
movie2.c:79:93: warning: passing argument 5 of ‘maapi_get_str_elem’ from incompatible pointer type [-Wincompatible-pointer-types]
tr_elem(sock, th, f_name, “/movie/actors/actor{%x}/ first_name”, &mc.keys[0]);
^
In file included from movie2.c:3:0:
…/include/confd_maapi.h:463:12: note: expected ‘const char *’ but argument is of type ‘confd_value_t * {aka struct confd_value *}’
extern int maapi_get_str_elem(int sock, int thandle, char *buf, int n,
^~~~~~~~
movie2.c:80:45: warning: passing argument 4 of ‘maapi_get_str_elem’ makes integer from pointer without a cast [-Wint-conversion]
maapi_get_str_elem(sock, th, l_name, “/movie/actors/actor{%x}/ last_name”, &mc.keys[0]);
^~~~~~~~~~~~~~
In file included from movie2.c:3:0:
…/include/confd_maapi.h:463:12: note: expected ‘int’ but argument is of type ‘char *’
extern int maapi_get_str_elem(int sock, int thandle, char *buf, int n,
^~~~~~~~
movie2.c:80:85: warning: passing argument 5 of ‘maapi_get_str_elem’ from incompatible pointer type [-Wincompatible-pointer-types]
str_elem(sock, th, l_name, “/movie/actors/actor{%x}/ last_name”, &mc.keys[0]);
^
In file included from movie2.c:3:0:
…/include/confd_maapi.h:463:12: note: expected ‘const char *’ but argument is of type ‘confd_value_t * {aka struct confd_value *}’
extern int maapi_get_str_elem(int sock, int thandle, char *buf, int n,
^~~~~~~~
movie2.c:81:44: warning: passing argument 4 of ‘maapi_get_str_elem’ makes integer from pointer without a cast [-Wint-conversion]
maapi_get_str_elem(sock, th, l_upd, “/movie/actors/actor{%x}/ last_update”, &mc.keys[0]);
^~~~~~~~~~~~~~
In file included from movie2.c:3:0:
…/include/confd_maapi.h:463:12: note: expected ‘int’ but argument is of type ‘char *’
extern int maapi_get_str_elem(int sock, int thandle, char *buf, int n,
^~~~~~~~
movie2.c:81:86: warning: passing argument 5 of ‘maapi_get_str_elem’ from incompatible pointer type [-Wincompatible-pointer-types]
tr_elem(sock, th, l_upd, “/movie/actors/actor{%x}/ last_update”, &mc.keys[0]);
^
In file included from movie2.c:3:0:
…/include/confd_maapi.h:463:12: note: expected ‘const char *’ but argument is of type ‘confd_value_t * {aka struct confd_value *}’
extern int maapi_get_str_elem(int sock, int thandle, char *buf, int n,
^~~~~~~~
movie2.c: In function ‘main’:
movie2.c:96:17: warning: implicit declaration of function ‘getopt’; did you mean ‘getw’? [-Wimplicit-function-declaration]
while ((c = getopt(argc, argv, “rc”)) != -1) {
^~~~
getw
At top level:
movie2.c:9:20: warning: ‘groups’ defined but not used [-Wunused-variable]
static const char *groups[] = {“rahini”};
^~~~
…/src/confd/build/include.mk:121: recipe for target ‘movie2.o’ failed
make: * [movie2.o] Error 1
How to resolve this sir? Could you please help us to make it out?
Following are attachments of c, yang, xml files: