filcuc / dotherside

C language library for creating bindings for the Qt QML language
Other
200 stars 40 forks source link

Does not compile with a C compiler #88

Closed zilti closed 3 years ago

zilti commented 4 years ago

As the title says. This fails to compile with a C compiler. First, the typedefs for the enums are missing. Then, I am not too versed in C itself, but it seems it is not possible to set default values for function parameters.

filcuc commented 4 years ago

what do you mean?

zilti commented 4 years ago

Fails to be used from a C project. I include the DOtherSide.h header, which only works when I use g++, not when using normal gcc in C mode.

filcuc commented 4 years ago

please report the errors

filcuc commented 4 years ago

the DOtherSideTypes should have code like this

/// \brief Store an array of QVariant
/// \note This struct should be freed by calling dos_qvariantarray_delete(DosQVariantArray *ptr). This in turn
/// cleans up the internal array
struct DosQVariantArray {
    /// The number of elements
    int size;
    /// The array
    DosQVariant **data;
};

#ifndef __cplusplus
typedef struct DosQVariantArray DosQVariantArray;
#endif
filcuc commented 4 years ago

thus defining the c structs

filcuc commented 4 years ago

@zilti can you please post the error?

zilti commented 4 years ago
dotherside/lib/include/DOtherSide/DOtherSide.h:58:59: error: unknown type name ‘DosQEventLoopProcessEventFlag’
 DOS_API void DOS_CALL dos_qcoreapplication_process_events(DosQEventLoopProcessEventFlag flags = DosQEventLoopProcessEventFlag::DosQEventLoopProcessEventFlagProcessAllEvents);
                                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/zilti/projects/qml/qml.lowlevel.c:11:0:
dotherside/lib/include/DOtherSide/DOtherSide.h:61:65: error: unknown type name ‘DosQEventLoopProcessEventFlag’
 DOS_API void DOS_CALL dos_qcoreapplication_process_events_timed(DosQEventLoopProcessEventFlag flags, int ms);
                                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dotherside/lib/include/DOtherSide/DOtherSide.h:463:53: error: unknown type name ‘DosQtConnectionType’
                                                     DosQtConnectionType connection_type);
                                                     ^~~~~~~~~~~~~~~~~~~
dotherside/lib/include/DOtherSide/DOtherSide.h:756:50: error: unknown type name ‘DosQtConnectionType’
                                                  DosQtConnectionType connection_type);