Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make error #6

Open
867380699 opened this issue Jul 21, 2023 · 1 comment
Open

make error #6

867380699 opened this issue Jul 21, 2023 · 1 comment

Comments

@867380699
Copy link

cd build ; lua ../src/gen_c_header.lua ../dict/flypy.dict
cd build ; lua ../src/gen_c_entry.lua libflypy
gcc -shared -fPIC -llua -Ibuild -Isrc build/libflypy.c src/dict.c -o build/libflypy.so
In file included from src/dict.c:4:
build/dict.h:5:5: error: unknown type name ‘uint32_t’
    5 |     uint32_t next;
      |     ^~~~~~~~
build/dict.h:6:5: error: unknown type name ‘uint8_t’
    6 |     uint8_t is_list;
      |     ^~~~~~~
build/dict.h:7:5: error: unknown type name ‘uint8_t’
    7 |     uint8_t frequency;
      |     ^~~~~~~
src/dict.c:8:49: error: unknown type name ‘uint32_t’
    8 | typedef void (*QUERY_ITEM_HANDLE)(lua_State *L, uint32_t hash, const char *code);
      |                                                 ^~~~~~~~
src/dict.c:6:1: note: ‘uint32_t’ is defined in header ‘<stdint.h>’; did you forget to ‘#include <stdint.h>’?
    5 | #include "query.h"
  +++ |+#include <stdint.h>
    6 | 
src/dict.c:10:45: error: unknown type name ‘uint32_t’
   10 | static void add_dict_as_table(lua_State *L, uint32_t hash, const char *code)
      |                                             ^~~~~~~~
src/dict.c:10:45: note: ‘uint32_t’ is defined in header ‘<stdint.h>’; did you forget to ‘#include <stdint.h>’?
src/dict.c: In function ‘get_hash_by_code’:
src/dict.c:28:5: error: unknown type name ‘uint32_t’
   28 |     uint32_t hash = 0;
      |     ^~~~~~~~
src/dict.c:28:5: note: ‘uint32_t’ is defined in header ‘<stdint.h>’; did you forget to ‘#include <stdint.h>’?
src/dict.c:35:18: error: ‘uint32_t’ undeclared (first use in this function)
   35 |         hash += (uint32_t)((code[i] - 'a' + 1) * pow(27, i));
      |                  ^~~~~~~~
src/dict.c:35:18: note: ‘uint32_t’ is defined in header ‘<stdint.h>’; did you forget to ‘#include <stdint.h>’?
src/dict.c:35:18: note: each undeclared identifier is reported only once for each function it appears in
src/dict.c: At top level:
src/dict.c:40:47: error: unknown type name ‘uint32_t’
   40 | static int query_items_by_hash(lua_State *L,  uint32_t hash, QUERY_ITEM_HANDLE item_handle, const char *code)
      |                                               ^~~~~~~~
src/dict.c:40:47: note: ‘uint32_t’ is defined in header ‘<stdint.h>’; did you forget to ‘#include <stdint.h>’?
src/dict.c:40:62: error: unknown type name ‘QUERY_ITEM_HANDLE’
   40 | static int query_items_by_hash(lua_State *L,  uint32_t hash, QUERY_ITEM_HANDLE item_handle, const char *code)
      |                                                              ^~~~~~~~~~~~~~~~~
src/dict.c: In function ‘query’:
src/dict.c:63:5: error: unknown type name ‘uint32_t’
   63 |     uint32_t    return_cnt     = 0;
      |     ^~~~~~~~
src/dict.c:63:5: note: ‘uint32_t’ is defined in header ‘<stdint.h>’; did you forget to ‘#include <stdint.h>’?
src/dict.c:71:23: warning: implicit declaration of function ‘query_items_by_hash’ [-Wimplicit-function-declaration]
   71 |         return_cnt += query_items_by_hash(L, get_hash_by_code(code), add_dict_as_table, code);
      |                       ^~~~~~~~~~~~~~~~~~~
src/dict.c:71:70: error: ‘add_dict_as_table’ undeclared (first use in this function)
   71 |         return_cnt += query_items_by_hash(L, get_hash_by_code(code), add_dict_as_table, code);
      |                                                                      ^~~~~~~~~~~~~~~~~
make: *** [Makefile:15: build/libflypy.so] Error 1
@867380699
Copy link
Author

Then I try add #include "stdint.h" at the top of dict.c and it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant