【问题标题】:Linking problems with jsoncppjsoncpp的链接问题
【发布时间】:2015-02-13 22:51:55
【问题描述】:

我正在尝试在我自己的项目中使用 jsoncpp 的合并版本。使用我的makefile时,它抱怨它没有找到json_tool.h:

input/jsoncpp.cpp:193:23: fatal error: json_tool.h: No such file or directory
#include "json_tool.h"

在我的 makefile 中有:

jsoncpp.o: input/jsoncpp.cpp input/json/json.h
    $(CXX) $(CXXFLAGS) -c input/jsoncpp.cpp $(LIBS)

jsoncpp.cpp 和 json/json.h 是由 amalgamate.py 脚本创建的。我做错了什么?

【问题讨论】:

    标签: c++ json linker jsoncpp


    【解决方案1】:

    您没有正确设置包含路径

    将以下内容添加到您的构建命令中:

    -I input/json/
    

    【讨论】:

    • 好点。 (虽然它应该是-I input/。)我们应该使用#include "json/json.h" 而不是#include <json/json.h>Fixed.
    • @cdunn 是的,当然 :) 我想现在由你来提供一个权威的答案 :)
    • s/intented/intended/
    猜你喜欢
    • 1970-01-01
    • 2011-06-24
    • 1970-01-01
    • 2011-11-25
    • 1970-01-01
    • 2021-08-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多