creating a libjson library to link to xcode

末鹿安然 提交于 2019-12-11 11:15:23

问题


I apologize in advance for the possibly noobish question but I could not find the answer to this anywhere on the internet or SO for the past few days of looking.

I'm trying to create a c++ project in xcode and I want to use libjson to parse my json work. Unfortunately, I have been unable to get the environment load it. I tried the directions and looked through the make file. I ran make install and tried flicking various switches here and there in the make file. I basically tried to follow directions such as the one advised here: How to create a libJSON library?

When I try to run the make file I keep running into this issue for which I could not find a solution addressing it online:

/usr/bin/ranlib: file: libjson.a(JSONAllocator.o) has no symbols
/usr/bin/ranlib: file: libjson.a(JSONDebug.o) has no symbols
/usr/bin/ranlib: file: libjson.a(JSONMemory.o) has no symbols
/usr/bin/ranlib: file: libjson.a(JSONNode_Mutex.o) has no symbols
/usr/bin/ranlib: file: libjson.a(JSONPreparse.o) has no symbols
/usr/bin/ranlib: file: libjson.a(libjson.o) has no symbols

What does has no symbols mean? how could I compile it otherwise?

One person suggested adding the libraries directly but I was not sure how to get that done and kept getting compile errors.

I tried installing macport and successfully got jsoncpp to install but could not find libjson as a port. I want to end up using the c++ style interface for libjson.

I'm trying to get it to work on XCODE I have os 10.8.5 on an old early 2009 macbook intel core 2 duo.

EDIT: Here is the output of 'make install':

============================================================
libjson version: 7.6.1 target:  OS: Darwin
============================================================
Install header files
mkdir -p /Users/aps/Desktop/libj/include/libjson
cp -f ./*.h /Users/aps/Desktop/libj/include/libjson
mkdir -p /Users/aps/Desktop/libj/include/libjson/_internal/Source
cp -f ./_internal/Source/*.h /Users/aps/Desktop/libj/include/libjson/_internal/Source
cp -r ./_internal/Source/JSONDefs /Users/aps/Desktop/libj/include/libjson/_internal/Source
chmod -R a+r /Users/aps/Desktop/libj/include/libjson
find  /Users/aps/Desktop/libj/include/libjson -type d -exec chmod a+x {} \;
cp -rv _internal/Source/Dependencies/ /Users/aps/Desktop/libj/include/libjson/_internal/Source
_internal/Source/Dependencies/ -> /Users/aps/Desktop/libj/include/libjson/_internal/Source
_internal/Source/Dependencies//libbase64++ -> /Users/aps/Desktop/libj/include/libjson/_internal/Source/libbase64++
_internal/Source/Dependencies//libbase64++/libbase64++.h -> /Users/aps/Desktop/libj/include/libjson/_internal/Source/libbase64++/libbase64++.h
_internal/Source/Dependencies//mempool++ -> /Users/aps/Desktop/libj/include/libjson/_internal/Source/mempool++
_internal/Source/Dependencies//mempool++/mempool.h -> /Users/aps/Desktop/libj/include/libjson/_internal/Source/mempool++/mempool.h
Install header files: Done.
mkdir -p Objects_static
Archive
cd Objects_static ; \
    ar -cvq libjson.a internalJSONNode.o JSONAllocator.o JSONChildren.o JSONDebug.o JSONIterators.o JSONMemory.o JSONNode.o JSONNode_Mutex.o JSONPreparse.o JSONStream.o JSONValidator.o JSONWorker.o JSONWriter.o libjson.o  ; \
    mv -f libjson.a ../
q - internalJSONNode.o
q - JSONAllocator.o
q - JSONChildren.o
q - JSONDebug.o
q - JSONIterators.o
q - JSONMemory.o
q - JSONNode.o
q - JSONNode_Mutex.o
q - JSONPreparse.o
q - JSONStream.o
q - JSONValidator.o
q - JSONWorker.o
q - JSONWriter.o
q - libjson.o
Archive: Done
Install static library
cp -f ./libjson.a /Users/aps/Desktop/libj/lib
Install static library: Done.

回答1:


In the end, I tried just copying the entire source project into my xcode project and building it. it ended up solving the issue. I am still not sure why I could not make the library and get it to work but hopefully I will find out soon as well.



来源:https://stackoverflow.com/questions/20010975/creating-a-libjson-library-to-link-to-xcode

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!