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

json-c compile in window xp #245

Closed
RafsanjaniRahman opened this issue Jul 29, 2016 · 7 comments
Closed

json-c compile in window xp #245

RafsanjaniRahman opened this issue Jul 29, 2016 · 7 comments

Comments

@RafsanjaniRahman
Copy link

Hi, Just want to know if json-c lib can support compilation in window xp?

@hawicz
Copy link
Member

hawicz commented Jul 29, 2016

If you're asking whether itks possible to build json-c, I have no idea. You'll likely need to make some adjustments, and if they're minimal enough I might accept them as pull requests. I suspect this will largely depend on how you're trying to build (Visual Studio, cygwin gcc, mingw?).
However, insofar as any platform can be considered "supported", Windows XP is not on that list and you'll be largely on your own making it work. I'll be happy to help if I can, but I certainly don't have an XP machine anywhere and I suspect there are few who do.

@jamesmyatt
Copy link
Contributor

jamesmyatt commented Aug 10, 2016

It certainly used to be possible to compile on Windows: https://ci.appveyor.com/project/Nzbuu/json-c/build/master.27

However, it now looks like this is broken. https://ci.appveyor.com/project/Nzbuu/json-c/build/master.29

For reference, the error message is:

     c:\projects\json-c\json_object.c(727): error C2664: 'int json_object_double_to_json_string_format(json_object *,printbuf *,int,int,const char *)': cannot convert argument 5 from 'void *' to 'const char *' [C:\projects\json-c\json-c.vcxproj]

@hawicz
Copy link
Member

hawicz commented Aug 10, 2016

Seems to be c++ stupidity not allowing void. Do you know how to get that to build there as a C program?

@jkaster
Copy link

jkaster commented Sep 12, 2016

This is an issue for both Win32 and x64 platforms. I tried limiting scope to Win32 but the problem still occurs.
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\stdio.h(346) : see declaration of '_snprintf' json_object.c(723): error C2664: 'int json_object_double_to_json_string_format(json_object *,printbuf *,int,int,const char *)' : cannot convert argument 5 from 'void *' to 'const char *' [d:\dev\json-c\json-c.vcxproj] Conversion from 'void*' to pointer to non-'void' requires an explicit cast

I tried building from the command-line:
msbuild json-c.vcxproj /p:configuration=debug /p:platform=Win32
msbuild json-c.vcxproj /p:configuration=release /p:platform=Win32

@jkaster
Copy link

jkaster commented Sep 12, 2016

It compiles if you change json_object.c lines 722:723 from:
return json_object_double_to_json_string_format(jso, pb, level, flags, jso->_userdata);

to
return json_object_double_to_json_string_format(jso, pb, level, flags, (char *)jso->_userdata);

@hawicz
Copy link
Member

hawicz commented Sep 12, 2016

It seems you're getting the "error" because you're compiling it as a c++ program, not a c one.
If you can figure out how to get VS to build this as actual C code, and eliminate the problem that way, then I'll be happy to apply that change, but I have little desire to litter the code with casts to cater to attempts to build the code as something it isn't.

@sdrsdr
Copy link
Contributor

sdrsdr commented Oct 7, 2016

windows compile error is fixed in pull request #277

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

5 participants