crossdb-org / crossdb

Ultra High-performance Lightweight Embedded and Server OLTP RDBMS✨
https://crossdb.org
Mozilla Public License 2.0
184 stars 12 forks source link

how to make example.c? #18

Closed sprappcom closed 2 months ago

sprappcom commented 2 months ago

Describe the bug

(base) root@ubuntu:/home/ubuntu/Documents/Programs/crossdb/examples/c# make
cc -o example example.c -lcrossdb -lpthread
In file included from example.c:1:
example.c: In function ‘main’:
example.c:9:9: error: invalid use of incomplete typedef ‘xdb_conn_t’
    9 |         XDB_CHECK (NULL != pConn, printf ("failed to create DB\n"); return -1;);
      |         ^~~~~~~~~
example.c:9:9: error: invalid use of incomplete typedef ‘xdb_conn_t’
    9 |         XDB_CHECK (NULL != pConn, printf ("failed to create DB\n"); return -1;);
      |         ^~~~~~~~~
example.c:9:25: warning: passing argument 1 of ‘xdb_errmsg’ makes pointer from integer without a cast [-Wint-conversion]
    9 |         XDB_CHECK (NULL != pConn, printf ("failed to create DB\n"); return -1;);
      |                         ^
      |                         |
      |                         int
/usr/include/crossdb.h:296:24: note: expected ‘xdb_res_t *’ but argument is of type ‘int’
  296 | xdb_errmsg (xdb_res_t *pRes);
      |             ~~~~~~~~~~~^~~~
example.c:13:9: warning: implicit declaration of function ‘XDB_RESCHK’ [-Wimplicit-function-declaration]
   13 |         XDB_RESCHK(pRes, printf ("Can't create table student\n"); goto error;);
      |         ^~~~~~~~~~
example.c:13:65: error: expected ‘)’ before ‘;’ token
   13 |         XDB_RESCHK(pRes, printf ("Can't create table student\n"); goto error;);
      |                   ~                                             ^
      |                                                                 )
example.c:15:65: error: expected ‘)’ before ‘;’ token
   15 |         XDB_RESCHK(pRes, printf ("Can't create table teacher\n"); goto error;);
      |                   ~                                             ^
      |                                                                 )
example.c:17:62: error: expected ‘)’ before ‘;’ token
   17 |         XDB_RESCHK(pRes, printf ("Can't create table book\n"); goto error;);
      |                   ~                                          ^
      |                                                              )
example.c:26:65: error: expected ‘)’ before ‘;’ token
   26 |         XDB_RESCHK(pRes, printf ("Can't insert table student\n"); goto error;);
      |                   ~                                             ^
      |                                                                 )
example.c:28:65: error: expected ‘)’ before ‘;’ token
   28 |         XDB_RESCHK(pRes, printf ("Can't insert table student\n"); goto error;);
      |                   ~                                             ^
      |                                                                 )
example.c:30:65: error: expected ‘)’ before ‘;’ token
   30 |         XDB_RESCHK(pRes, printf ("Can't insert table student\n"); goto error;);
      |                   ~                                             ^
      |                                                                 )
example.c:32:65: error: expected ‘)’ before ‘;’ token
   32 |         XDB_RESCHK(pRes, printf ("Can't insert table teacher\n"); goto error;);
      |                   ~                                             ^
      |                                                                 )
example.c:34:62: error: expected ‘)’ before ‘;’ token
   34 |         XDB_RESCHK(pRes, printf ("Can't insert table book\n"); goto error;);
      |                   ~                                          ^
      |                                                              )
example.c:48:59: error: expected ‘)’ before ‘;’ token
   48 |         XDB_RESCHK(pRes, printf ("Can't update id=%d\n",2); goto error;);
      |                   ~                                       ^
      |                                                           )
example.c:73:59: error: expected ‘)’ before ‘;’ token
   73 |         XDB_RESCHK(pRes, printf ("Can't delete id=%d\n",3); goto error;);
      |                   ~                                       ^
      |                                                           )

To Reproduce cannot make in examples/c folder cannot "make example" also

Desktop (please complete the following information):

sprappcom commented 2 months ago

fixed.