Skip to content

Including okon.h from C code results in compiler errors #52

@cppforliving

Description

@cppforliving

Minimal example to reproduce the issue on UNIX-like OS (Ubuntu 18.04 + GCC 7.5.0 in this case)

$ echo >test.c "#include <okon/okon.h>" && cc test.c -I "<okon_root_dir>/include"
In file included from test.c:1:0:
<okon_root_dir>/include/okon/okon.h:45:1: error: unknown type name ‘okon_prepare_result’; use ‘enum’ keyword to refer to the type
 okon_prepare_result okon_prepare(const char* input_db_file_path, const char* working_directory,
 ^~~~~~~~~~~~~~~~~~~
 enum 
<okon_root_dir>/include/okon/okon.h:62:1: error: unknown type name ‘okon_exists_result’; use ‘enum’ keyword to refer to the type
 okon_exists_result okon_exists_text(const char* sha1, const char* prepared_file_path);
 ^~~~~~~~~~~~~~~~~~
 enum 
<okon_root_dir>/include/okon/okon.h:70:1: error: unknown type name ‘okon_exists_result’; use ‘enum’ keyword to refer to the type
 okon_exists_result okon_exists_binary(const void* sha1, const char* processed_file_path);
 ^~~~~~~~~~~~~~~~~~
 enum 

Consider reworking the enum definitions in okon.h as proposed below

typedef enum abc {
   // ...
} abc;

Also consider adding some C API regression test

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions