gpt4 book ai didi

c++ - 使用脚本在原子中使用 Armadillo

转载 作者:行者123 更新时间:2023-12-02 10:29:54 27 4
gpt4 key购买 nike

我有一种方法可以在使用 Armadillo 的原子中使用脚本编译c++文件?我找不到任何与此相关的信息。
我已经安装了 Armadillo ,并尝试使用原子脚本编写一些基本代码:

#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)

最佳答案

如果我正确阅读了source code for this atom-script thing,它只是将-Wall -include stdio.h硬编码为编译选项。您需要添加-larmadillo才能将其链接到Armadillo库。
简而言之:您不能将atom-script与自定义库结合使用,除非您编辑扩展名以在编译命令行中对库进行硬编码。

关于c++ - 使用脚本在原子中使用 Armadillo ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62654678/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com