超表库链接问题

发布于 2024-10-23 19:21:21 字数 1187 浏览 5 评论 0原文

我已经在 /opt/hypertable/current/ 中安装了 hypertable,并且我从 hypertable 运行了一个示例程序...

#include <Common/Compat.h>

#include <iostream>
#include <fstream>
#include <string>

#include <Common/System.h>
#include <Common/Error.h>

#include <Hypertable/Lib/Client.h>
#include <Hypertable/Lib/KeySpec.h>

using namespace Hypertable;

int main(int argc, char* argv[]) {
        ClientPtr client_ptr;
        TablePtr table_ptr;
        TableMutatorPtr mutator_ptr;
        KeySpec key;

        const char* install_dir = "/opt/hypertable/current/";

        client_ptr = new Client( System::locate_install_dir(install_dir) );

}

我收到此错误,

g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/testes.d" -MT"src/testes.d" -o"src/testes.o" "../src/testes.cpp"
../src/testes.cpp:1: fatal error: Common/Compat.h: No such file or directory

我使用 eclipse CDT 进行开发,并使用项目 Properties 进行链接->c/c++build->setting->Libraries->LibrarySetPath(-L) 并且我已经在 -l 中签署了 HyperCommon 我设置了它正如 /opt/hypertable/current/include/ 任何人都可以告诉我你收到了这个错误...

i have installed hypertable in /opt/hypertable/current/ and i run an example program from hypertable...

#include <Common/Compat.h>

#include <iostream>
#include <fstream>
#include <string>

#include <Common/System.h>
#include <Common/Error.h>

#include <Hypertable/Lib/Client.h>
#include <Hypertable/Lib/KeySpec.h>

using namespace Hypertable;

int main(int argc, char* argv[]) {
        ClientPtr client_ptr;
        TablePtr table_ptr;
        TableMutatorPtr mutator_ptr;
        KeySpec key;

        const char* install_dir = "/opt/hypertable/current/";

        client_ptr = new Client( System::locate_install_dir(install_dir) );

}

i got this error

g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/testes.d" -MT"src/testes.d" -o"src/testes.o" "../src/testes.cpp"
../src/testes.cpp:1: fatal error: Common/Compat.h: No such file or directory

i used eclipse CDT for my development and i linked using project Properties->c/c++build->setting->Libraries->LibrarySetPath(-L) and i have inked the HyperCommon also in -l this i set it as /opt/hypertable/current/include/ can any one tell me y i am getting this error...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

情未る 2024-10-30 19:21:21

构建软件时需要设置两个不同的路径:include 路径和library 路径。你似乎让他们感到困惑。

include 路径是查找所有 .h 文件的路径。如果您遇到包含路径问题,它将在编译时(构建每个单独的 .o 文件时)显现出来,这就是您所看到的。 “Common/Compat.h:没有这样的文件或目录”意味着您可能缺少包含路径。

库路径是在链接时查找 DLL/共享对象文件的路径。如果您遇到库路径问题,它将在链接时(从 .o 文件创建最终可执行文件时)显现出来。你还没有达到编译的那个阶段。

因此,执行 LibrarySetPath 并设置 -l-L 是链接器/库的事情;您想要修复包含路径。

最有可能的是,您希望将 /opt/hypertable/current/include/ 添加到包含路径(在 Eclipse 中)。在 GCC 命令行上,这将使用 -I /opt/hypertable/current/include/ 完成,而不是使用 -L 完成。

There are two different paths you need to set when building software: the include path and the library path. You seem to be confusing them.

The include path is the path to find all the .h files. If you have an include path problem, it will manifest at compile time (when building each individual .o file), which is what you are seeing. "Common/Compat.h: No such file or directory" means you are likely missing an include path.

The library path is the path to find the DLL/shared object files at link time. If you have a library path problem, it will manifest at link time (when creating the final executable from the .o files). You are not up to that stage of compilation.

So doing LibrarySetPath and setting -l or -L is a linker/library thing; you want to fix the include path.

Most likely, you want to add /opt/hypertable/current/include/ to the include path (in Eclipse). On the GCC command line, this will be done with -I /opt/hypertable/current/include/, NOT with -L.

Spring初心 2024-10-30 19:21:21

您想要将 /opt/hypertable/current/include/ThriftBroker/gen-cpp 添加到包含路径
你还得一起编译/opt/hypertable/current/include/ThriftBroker/gen-cpp下的cpp文件

you want to add /opt/hypertable/current/include/ThriftBroker/gen-cpp to the include path
你还得一起编译/opt/hypertable/current/include/ThriftBroker/gen-cpp下的cpp文件

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文