我提前为这个可能有问题的问题道歉,但在过去的几天里,我无法在互联网或SO上找到答案。
我正在尝试在xcode中创建一个c ++项目,我想用libjson来解析我的json工作。不幸的是,我无法让环境加载它。我尝试了指示并查看了make文件。我运行make install并试着在make文件中点击各种开关。我基本上试着遵循这里建议的方向: How to create a libJSON library?
当我尝试运行make文件时,我一直遇到这个问题,我无法在网上找到解决方案:
/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
没有符号是什么意思?我怎么能编译呢?
有人建议直接添加库但我不知道如何完成这些并且不断出现编译错误。
我尝试安装macport并成功安装jsoncpp但找不到libjson作为端口。我想最终使用libjson的c ++样式接口。
我正试图让它在XCODE上工作我在2009年早期的macbook intel core 2 duo上有os 10.8.5。
编辑:这是'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.
答案 0 :(得分:1)
最后,我尝试将整个源项目复制到我的xcode项目中并构建它。它最终解决了这个问题。我仍然不确定为什么我不能建立图书馆并让它工作,但希望我很快就会发现。