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

Compile fails on Particle with cJON.h errors #3

Closed
rcomeau opened this issue Apr 18, 2016 · 3 comments
Closed

Compile fails on Particle with cJON.h errors #3

rcomeau opened this issue Apr 18, 2016 · 3 comments
Labels

Comments

@rcomeau
Copy link

rcomeau commented Apr 18, 2016

Here is the error messages:

In file included from subscribe2.cpp:1:0:
cJSON.h:58:24: error: expected ';' at end of member declaration
void _(_malloc_fn)(size_t sz);
^

cJSON.h:58:33: error: expected ')' before 'sz'
void _(_malloc_fn)(size_t sz);
^

@DaveGamble
Copy link
Owner

At HEAD, line 58 reads: void _(_malloc_fn)(size_t sz);
What do you have?

@FSMaxB
Copy link
Collaborator

FSMaxB commented Nov 7, 2016

That looks like this code is not from cJSON but has been added by somebody else later.

@jchenbr
Copy link

jchenbr commented Dec 7, 2016

It is very likely that you are using old version cJSON in c++, where size_t is not supported as default type by some c++ compiler. So the compiler may interpret it as a declaration of some member function.
A quick solution is including 'string.h' in the cJSON.h.

FSMaxB pushed a commit that referenced this issue Jan 17, 2017
…malloc_overrides.h neglected to include <stddef.h> even though the reference 'size_t' and 'NULL'.
FSMaxB pushed a commit that referenced this issue Jan 17, 2017
Fixes issues #3 and #116 (Thanks!)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants