Skip to content

Compile error with specific config #66

@dofuuz

Description

@dofuuz

When mpack.h included from .cpp,
defining #define MPACK_WRITER 0 in config causing compile error.

src\mpack.h:3253:31: error: variable or field 'mpack_write' declared void
 MPACK_INLINE void mpack_write(mpack_writer_t* writer, int8_t value) {
                               ^~~~~~~~~~~~~~
src\mpack.h:3253:31: error: 'mpack_writer_t' was not declared in this scope
src\mpack.h:3253:31: note: suggested alternative: 'mpack_error_t'
 MPACK_INLINE void mpack_write(mpack_writer_t* writer, int8_t value) {
                               ^~~~~~~~~~~~~~
                               mpack_error_t
src\mpack.h:3253:47: error: 'writer' was not declared in this scope
 MPACK_INLINE void mpack_write(mpack_writer_t* writer, int8_t value) {
                                               ^~~~~~
src\mpack.h:3253:47: note: suggested alternative: 'fwrite'
 MPACK_INLINE void mpack_write(mpack_writer_t* writer, int8_t value) {
                                               ^~~~~~
                                               fwrite
src\mpack.h:3253:62: error: expected primary-expression before 'value'
 MPACK_INLINE void mpack_write(mpack_writer_t* writer, int8_t value) {
                                                              ^~~~~
src\mpack.h:3257:31: error: variable or field 'mpack_write' declared void
 MPACK_INLINE void mpack_write(mpack_writer_t* writer, int16_t value) {
                               ^~~~~~~~~~~~~~
src\mpack.h:3257:31: error: 'mpack_writer_t' was not declared in this scope
src\mpack.h:3257:31: note: suggested alternative: 'mpack_error_t'
 MPACK_INLINE void mpack_write(mpack_writer_t* writer, int16_t value) {
                               ^~~~~~~~~~~~~~
                               mpack_error_t
src\mpack.h:3257:47: error: 'writer' was not declared in this scope
 MPACK_INLINE void mpack_write(mpack_writer_t* writer, int16_t value) {
                                               ^~~~~~
src\mpack.h:3257:47: note: suggested alternative: 'fwrite'
 MPACK_INLINE void mpack_write(mpack_writer_t* writer, int16_t value) {
                                               ^~~~~~
                                               fwrite
src\mpack.h:3257:63: error: expected primary-expression before 'value'
 MPACK_INLINE void mpack_write(mpack_writer_t* writer, int16_t value) {
                                                               ^~~~~
...
...

possible fix:

in mpack.h(v1.0 amalgamated) line 3239
from

#if defined(__cplusplus) || defined(MPACK_DOXYGEN)

to

#if (MPACK_WRITER && defined(__cplusplus)) || defined(MPACK_DOXYGEN)

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