Ask coding questions

← Back to all posts
adding external lib
KaioEneas

Hello guys!
So, I'm doing a college project and I need to use a external lib to parse a json file. I'm using the json-c library as I saw in this video: https://www.youtube.com/watch?v=dQyXuFWylm4
I tried everything to make it work but it didn't.....
To install it I just copied the files from the lib github and uploaded in my project. I'm getting this error:

main.c:(.text+0xa1): undefined reference to `json_tokener_parse'

main.c:(.text+0xbc): undefined reference to `json_object_object_get_ex'

main.c:(.text+0xcb): undefined reference to `json_object_get_string'

It seems like the lib is not properly installed, since some code worked and some not. Thank you in advance :)

Voters
MohammadElshaer
KaioEneas
Comments
hotnewtop
SixBeeps

This might sound weird, but try explicitly importing json_tokener.h and json_object.h into main.c

KaioEneas

@SixBeeps Same error :/

SixBeeps

@KaioEneas Ok, I just did a Google search and this came up. I don't do C, but maybe you'd understand it? You can run gcc in the console.