【问题标题】:linking errors between boost::program_options and armadillo for cmake generated eclipse projectcmake 生成的 Eclipse 项目的 boost::program_options 和犰狳之间的链接错误
【发布时间】:2014-10-15 15:36:31
【问题描述】:

所以我已经成功地在我的项目中使用了 cmake 和 boost。 我想开始合并犰狳(4.400.1)

我在我的系统上使用环境模块 (http://modules.sourceforge.net/)。 我用 gcc-4.8.1 构建。 CentOS 6.4。 我从源代码安装了 OpenBLAS (0.2.10) 和犰狳,并创建了环境模块。

过去我只需要在 LD_LIBRARY_PATH 前面加上 lib 目录,但这对于犰狳来说还不够,因为我遇到了以下链接错误(无法找到 lib):

g++ example1.cpp -o example1 -O2 -larmadillo 

使用-L 选项有效:

g++ example1.cpp -o example1 -O2 -larmadillo -L${ARMADILLO_HOME}/lib

我已经将犰狳库目录放在LD_LIBRARY_PATH 中。如何设置环境变量以便以下链接不会出错?

g++ example1.cpp -o example1 -O2 -larmadillo

【问题讨论】:

    标签: c++ eclipse boost environment-variables armadillo


    【解决方案1】:

    我不得不将犰狳 lib 目录放在环境变量 LIBRARY_PATH 而不是 LD_LIBRARY_PATH

    这样做允许在发出命令时链接继续进行而不会出错:

    g++ example1.cpp -o example1 -O2 -larmadillo
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-16
      • 1970-01-01
      • 1970-01-01
      • 2023-01-18
      • 2013-12-20
      相关资源
      最近更新 更多