Build json-c-0.10 on Win32 system

1,150 views
Skip to first unread message

Borman Squirrel

unread,
Jan 21, 2013, 2:30:32 PM1/21/13
to jso...@googlegroups.com
Hi,

I am trying to build json-c-0.10 on win32 ... I've tried to do that under mingw-msys, renaming  config.h.win32 to config.h following the instructions provided in the readme but gives me this error:

In file included from linkhash.h:16:0,
                 from json_object.c:22:
json_object.h:437:48: error: unknown type name 'int32_t'
json_object.h:444:50: error: unknown type name 'int64_t'
json_object.h:461:1: error: unknown type name 'int32_t'
json_object.h:476:1: error: unknown type name 'int64_t'
In file included from json_object.c:26:0:
json_object_private.h:31:5: error: unknown type name 'int64_t'
In file included from json_object.c:27:0:
json_util.h:27:46: error: unknown type name 'int64_t'
json_object.c:33:3: error: #error You do not have strdup on your system.
json_object.c: In function 'json_object_object_add':
json_object.c:384:3: warning: implicit declaration of function 'strdup' [-Wimplicit-function-declaration]
json_object.c:384:3: warning: passing argument 2 of 'lh_table_insert' makes pointer from integer without a cast [enabled by default]
In file included from json_object.c:22:0:
linkhash.h:231:12: note: expected 'void *' but argument is of type 'int'
json_object.c: In function 'json_object_int_to_json_string':
json_object.c:470:27: error: expected ')' before 'PRId64'
json_object.c: At top level:
json_object.c:473:41: error: unknown type name 'int32_t'
json_object.c:482:1: error: unknown type name 'int32_t'
json_object.c: In function 'json_object_get_int':
json_object.c:484:3: error: unknown type name 'int64_t'
json_object.c:498:2: warning: implicit declaration of function 'json_parse_int64' [-Wimplicit-function-declaration]
json_object.c:506:16: error: 'INT32_MIN' undeclared (first use in this function)
json_object.c:506:16: note: each undeclared identifier is reported only once for each function it appears in
json_object.c:508:21: error: 'INT32_MAX' undeclared (first use in this function)
json_object.c:511:11: error: 'int32_t' undeclared (first use in this function)
json_object.c:511:19: error: expected ';' before 'cint64'
json_object.c:513:21: error: expected ';' before 'jso'
json_object.c: At top level:
json_object.c:521:43: error: unknown type name 'int64_t'
json_object.c:530:1: error: unknown type name 'int64_t'
json_object.c: In function 'json_object_get_int64':
json_object.c:532:4: error: unknown type name 'int64_t'
json_object.c:539:13: error: 'int64_t' undeclared (first use in this function)
json_object.c:539:21: error: expected ';' before 'jso'
json_object.c: In function 'json_object_new_string':
json_object.c:614:23: warning: assignment makes pointer from integer without a cast [enabled by default]
make[2]: *** [json_object.lo] Error 1
make[2]: Leaving directory `/home/jukenplay/json-c'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/jukenplay/json-c'
make: *** [all] Error 2

Has Anybody been fought with that? :)

Ethan Brown

unread,
Jan 21, 2013, 2:55:02 PM1/21/13
to jso...@googlegroups.com
On Linux these things like int32_t are defined in a types.h file, which you probably have but may need to include the path to the directory containing the types.h file.

One of my co-workers who is a Windows guy (I'm pretty much linux only) said that json-c is included in the Cygwin library list, so you may want to take the Cygwin route.

Good luck!

Eric Haszlakiewicz

unread,
Jan 21, 2013, 3:56:42 PM1/21/13
to jso...@googlegroups.com


On Jan 21, 2013 1:30 PM, "Borman Squirrel" <triton....@gmail.com> wrote:
>
> I am trying to build json-c-0.10 on win32 ... I've tried to do that under mingw-msys, renaming  config.h.win32 to config.h following the instructions provided in the readme but gives me this error:
>
> In file included from linkhash.h:16:0,
>                  from json_object.c:22:
> json_object.h:437:48: error: unknown type name 'int32_t'

This should be handled by the json_inttypes.h header, but it's written with the assumption that if you're building on windows then you're using visual studio.  I doubt anyone has tried building with mingw, so you likely have some work to do to get this working.  Patches are, of course, appreciated.

Do you have a inttypes.h present on your system?  If so, did json_config.h get populated with JSON_C_HAVE_INTTYPES_H set to 1?  If not, you can probably fix a lot of those errors (temporarily) by editing that file.

Eric

Borman Squirrel

unread,
Jan 21, 2013, 3:59:22 PM1/21/13
to jso...@googlegroups.com
Thanks for the response!

Yes I know, on Cygwin works good, but I was trying to avoid cyg***.dll dependencies ... I have seen that there was a branch to build the library with Cmake but I don't know if it's considered on 0.10 version.
Reply all
Reply to author
Forward
0 new messages