Error compiling project c with mysql: error: unknown type name 'uint in linux

Can any body say in which cases this error occurs? I am trying to make a mysql connection on a linux machine in a project.

The options that I included in my gcc are as follows:

gcc a.c -o a -I/usr/include/mysql -Wall -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -L/usr/lib64 -lmysqlclient -lpthread -lm -ldl

   ]$ make

gcc  -g -O3 -Wall -std=c99 -pedantic -Wformat-security -Wno-format-zero-length -Werror -Wwrite-strings -Wformat -fdiagnostics-show-option -Wextra -Wsign-compare -Wcast-align -Wno-unused-parameter -fPIC -o clitest.o -c b.c  -I/usr/include/mysql -Wall -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -L/usr/lib64 -lmysqlclient -lpthread -lm -ldl

In file included from a.h:1:0,
                 from b.c:17:
/usr/include/mysql/my_global.h:1004:1: error: unknown type name ‘ulong
 typedef ulong nesting_map;  /* Used for flags of nesting constructs */
 ^

In file included from a.h:1:0,
                 from b.c:17:
/usr/include/mysql/my_global.h:1035:1: error: unknown type name ‘ulong
 typedef ulong  myf; /* Type of MyFlags in my_funcs */
 ^

In file included from /usr/include/mysql/my_global.h:1062:0,
                 from a.h:1,
                 from b.c:17:
/usr/include/mysql/my_dbug.h:32:3: error: unknown type name ‘uintuint level;            /* this nesting level, highest bit enables tracing */
   ^

/usr/include/mysql/my_dbug.h:49:64: error: unknown type name ‘uintextern void _db_enter_(const char *_func_, const char *_file_, uint _line_,
                                                                ^

/usr/include/mysql/my_dbug.h:51:26: error: unknown type name ‘uintextern  void _db_return_(uint _line_, struct _db_stack_frame_ *_stack_frame_);
                          ^

/usr/include/mysql/my_dbug.h:52:25: error: unknown type name ‘uintextern  void _db_pargs_(uint _line_,const char *keyword);
                         ^

/usr/include/mysql/my_dbug.h:55:24: error: unknown type name ‘uintextern  void _db_dump_(uint _line_,const char *keyword,
                        ^

In file included from /usr/include/mysql/mysql.h:73:0,
                 from a.h:2,
                 from b.c:17:

/usr/include/mysql/mysql_com.h:548:41: error: unknown type name ‘uintvoid my_net_set_write_timeout(NET *net, uint timeout);
                                         ^

/usr/include/mysql/mysql_com.h:549:40: error: unknown type name ‘uintvoid my_net_set_read_timeout(NET *net, uint timeout);
                                        ^

/usr/include/mysql/mysql_com.h:643:1: error: unknown type name ‘ulongulong STDCALL net_field_length(uchar **packet);
 ^

make: *** [clitest.o] Error 1
+4
source share
3 answers

Make sure I have my_global.h, like the first ones.

+3
source

I also had the same problem. I removed my_globals.h from the include headers and compiled my sample program. Check if it works for you.

+2
source

uint and ulong are defined in the types.h header file.

    /* sysv */
 89 typedef unsigned char           unchar;
 90 typedef unsigned short          ushort;
 91 typedef unsigned int            uint;
 92 typedef unsigned long           ulong;

check file types.h

http://lxr.free-electrons.com/source/include/linux/types.h#L91

-1
source

Source: https://habr.com/ru/post/1569392/


All Articles