我正在开发一个程序,该程序过去一直使用平面文件文本格式来存储其首选项,但是我希望切换到使用库来卸载所有这些自定义代码。我很喜欢json,我一直在关注jansson。
不过,我一直没有太多的运气,我所做的是首先在我的configure.ac文件中检查libjansson包中的json_string函数。
...
checking for a BSD-compatible install... /usr/bin/install -c
checking for vte_terminal_fork_command in -lvte... yes
checking for json_string in -ljansson... yes
...正如你所看到的,这是可行的,问题是当我运行make时,我得到了以下错误:
/home/niadh/Projects/x2/code/src/libX2.h:22: undefined reference to `json_string'我正在运行最新的Ubuntu,并安装了libjansson4和libjansson-dev包,如果有人能帮助我安装并运行它,我将不胜感激。如果我未能提供关键信息,请务必让我知道,我将努力提供进一步的信息。我也很期待这是我错过的一些简单的东西,如果是这样的话,我提前道歉。
为方便起见,下面是出现错误的libX2.h文件。
#include <jansson.h>
static gchar *getConfigDir() {
return g_build_filename(g_get_home_dir(), ".config", "X2", NULL);
}
static gchar *getConfigFile() {
return g_build_filename(getConfigDir(), "X2.conf", NULL);
}
static gchar *getTemplatesDir() {
return g_build_filename(getConfigDir(), "templates", NULL);
}
static gchar *getTemplate(gchar *template) {
return g_build_filename(getTemplatesDir, template, NULL);
}
static gchar *getDefaultPreferences() {
const gchar *font = "Sans 10";
const gchar *tabs = "bottom";
json_t *nothing = json_string("testing");
/*json_t *programmingFeatures = json_boolean(1);
json_t *syntaxHighlighting = json_boolean(1);
json_t *lineNumbering = json_boolean(1);
json_t *highlightLine = json_boolean(1);
json_t *terminal = json_boolean(1);
json_t *searchInWords = json_boolean(1);
json_t *caseSensitiveSearch = json_boolean(1);
json_t *lineWrapping = json_boolean(1);
json_t *fontInfo = json_string(font);
json_t *tabsPosition = json_string(tabs);*/
return "";
}发布于 2013-06-16 21:44:09
事实证明这是一个构建问题,我没有正确地编辑我的make文件,所以我回答了这个问题,这样它就不会因为任何潜在的未来读者的沮丧而没有得到回答。
https://stackoverflow.com/questions/16950375
复制相似问题