【问题标题】:undefined reference to `xdo_new(char const*)' [duplicate]对`xdo_new(char const *)'的未定义引用[重复]
【发布时间】:2015-04-10 19:10:47
【问题描述】:

我尝试在 cpp 中调用 libxdo,如下所示:

#include <xdo.h>

int main() {
    xdo_t *xdo = xdo_new(NULL);
    return  0;
}

并运行g++ /home/roroco/Dropbox/try/c/try/main.cpp -lxdo,它会引发

/tmp/ccWh9hHs.o: In function `main':
main.cpp:(.text+0xe): undefined reference to `xdo_new(char const*)'
collect2: error: ld returned 1 exit status

请告诉我发生了什么?

更新:我已经安装了 libxdo,但仍然出现此错误。

【问题讨论】:

    标签: c++ g++


    【解决方案1】:

    您的编译标志顺序错误。

    -lxdo 之后 main.cpp.

    【讨论】:

    • 它没有复制,当我g++ /home/roroco/Dropbox/try/c/try/main.cpp -lxdo时,它仍然报错
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-26
    • 2013-03-12
    • 2017-03-29
    • 1970-01-01
    • 2016-01-19
    • 1970-01-01
    相关资源
    最近更新 更多