简体   繁体   English

在带有脚本的原子中使用犰狳

[英]Using armadillo in atom with script

I there a way to compile a c++ file using script in atom that uses armadillo?我有办法在使用犰狳的原子中使用脚本编译 c++ 文件吗? I couldn't find anything related to it.我找不到任何与之相关的东西。

I already installed armadillo and tried compiling some basic code using script in atom:我已经安装了犰狳并尝试使用 atom 中的脚本编译一些基本代码:

#include <iostream>
#include <armadillo>

int main(int argc, const char **argv) {
  arma::arma_rng::set_seed_random();

  arma::Mat<double> A = arma::randu(4,4);
  std::cout << "A:\n" << A << "\n";

  return 0;
}

This is the error I got:这是我得到的错误:

Undefined symbols for architecture x86_64:
  "thread-local wrapper routine for arma::arma_rng_cxx11_instance", referenced from:
      arma::arma_rng::set_seed(unsigned long long) in test1-83e853.o
      arma::arma_rng::randu<double>::fill(double*, unsigned long long) in test1-83e853.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

If I read the source code for this atom-script thing correctly, it just hardcodes -Wall -include stdio.h as compilation options.如果我正确阅读了这个 atom-script 的源代码,它只是将-Wall -include stdio.h硬编码为编译选项。 You need to add -larmadillo to link it to the Armadillo library.您需要添加-larmadillo以将其链接到 Armadillo 库。

In short: you cannot use atom-script in combination with custom libraries, unless you edit the extension to hardcode the libraries in your compilation commandline.简而言之:您不能将 atom-script 与自定义库结合使用,除非您编辑扩展以在编译命令行中对库进行硬编码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM