簡體   English   中英

在帶有腳本的原子中使用犰狳

[英]Using armadillo in atom with script

我有辦法在使用犰狳的原子中使用腳本編譯 c++ 文件嗎? 我找不到任何與之相關的東西。

我已經安裝了犰狳並嘗試使用 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;
}

這是我得到的錯誤:

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)

如果我正確閱讀了這個 atom-script 的源代碼,它只是將-Wall -include stdio.h硬編碼為編譯選項。 您需要添加-larmadillo以將其鏈接到 Armadillo 庫。

簡而言之:您不能將 atom-script 與自定義庫結合使用,除非您編輯擴展以在編譯命令行中對庫進行硬編碼。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM