gpt4 book ai didi

c++ - 在 ubuntu 机器上构建 htdig

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:52:34 24 4
gpt4 key购买 nike

在我的 Ubuntu 机器上,安装了 htdig (www.htdig.org)。例如“which htdig”给我,/usr/bin/htdig

我想在/var/www/my_web_site 下安装 htdig即/var/www/my_web_site/htdig

额外信息:

  • gcc 版本 4.9.1 (Ubuntu 4.9.1-16ubuntu6)
  • GNU Make 4.0

对于 htdig-3.1.6:

当我运行“./configure”时,我得到:

configure: error: To compile ht://Dig, you will need a C++ library. Try installing libstdc++

“运行/sbin/ldconfig -p | grep stdc++”

我有:

  • libstdc++.so.6 (libc6,x86-64) =>/usr/lib/x86_64-linux-gnu/libstdc++.so.6
  • libstdc++.so.6 (libc6) =>/usr/lib/i386-linux-gnu/libstdc++.so.6

我还尝试了 htdig-3.2.0b6:

我运行“./configure”,似乎没问题。我得到了类似“现在你必须先运行‘make’然后运行‘make install’”这样的东西

当我运行“make”时,我遇到了很多错误,例如:

.....
Making all in htsearch
make[1]: Entering directory '/var/www/test/testme/sounddesign/htdig-3.2.0b6/htsearch'
g++ -DHAVE_CONFIG_H -I. -I. -I../include -DDEFAULT_CONFIG_FILE=\"/opt/www/conf/htdig.conf\" -I../include -I../htlib -I../htnet -I../htcommon -I../htword -I../db -I../db -DCONFIG_DIR=\"/opt/www/conf\" -I../htfuzzy -g -O2 -Wall -fno-rtti -fno-exceptions -c -o Display.o `test -f 'Display.cc' || echo './'`Display.cc
In file included from Display.cc:30:0:
Collection.h:39:10: error: extra qualification ‘Collection::’ on member ‘Open’ [-fpermissive]
void Collection::Open();
....
....
....
Display.cc:830:32: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
if (input->exists("endyear"))
^

知道我应该做什么吗?

最佳答案

编译器提示 Collection.h 中的类前缀 Collection:: 是不必要的,现在是非法的。

只需将 htsearch/Collection.h header 更改为:

class Collection : public Object
{
public:
//
// Construction/Destruction
//
Collection(const char *name, const char *wordFile,
const char *indexFile, const char *docFile,
const char *docExcerpt);
~Collection();

// COMMENT OUT OR REMOVE THESE TWO LINES:
// void Collection::Open();
// void Collection::Close();
// ADD THESE TWO:
void Open();
void Close();

(注释掉/删除声明打开/关闭的旧行并添加上面的最后两行)

这样做之后,htdig 3.2 b 6 为我编译成功。警告就是:警告。他们不会阻止成功的编译。现在这是一个非常古老的代码库,一些 C++ 总是不符合当前的编译器标准。

关于c++ - 在 ubuntu 机器上构建 htdig,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29840962/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com