在NeatBeans上用Armadillo库编译c
作者:互联网
我要编译包含Armadillo库的C程序.
使用此命令通过命令行可以解决此问题:
g++ '/arm.cpp' -o example -O1 -larmadillo
但是当我将-O1 -larmadillo添加到我的NetBeans项目的编译选项时,我收到了大量的错误.
我收到了这些错误:
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/home/atx/NetBeansProjects/armadillo'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux-x86/armadillo
make[2]: Entering directory `/home/atx/NetBeansProjects/armadillo'
mkdir -p dist/Debug/GNU-Linux-x86
g++ -O3 -o dist/Debug/GNU-Linux-x86/armadillo build/Debug/GNU-Linux-x86/main.o
build/Debug/GNU-Linux-x86/main.o: In function `gemv<double>':
/usr/include/armadillo_bits/blas_wrapper.hpp:79: undefined reference to `wrapper_dgemv_'
/usr/include/armadillo_bits/blas_wrapper.hpp:79: undefined reference to `wrapper_dgemv_'
/usr/include/armadillo_bits/blas_wrapper.hpp:79: undefined reference to `wrapper_dgemv_'
/usr/include/armadillo_bits/blas_wrapper.hpp:79: undefined reference to `wrapper_dgemv_'
build/Debug/GNU-Linux-x86/main.o: In function `gemm<double>':
/usr/include/armadillo_bits/blas_wrapper.hpp:114: undefined reference to `wrapper_dgemm_'
/usr/include/armadillo_bits/blas_wrapper.hpp:114: undefined reference to `wrapper_dgemm_'
/usr/include/armadillo_bits/blas_wrapper.hpp:114: undefined reference to `wrapper_dgemm_'
/usr/include/armadillo_bits/blas_wrapper.hpp:114: undefined reference to `wrapper_dgemm_'
collect2: ld returned 1 exit status
make[2]: *** [dist/Debug/GNU-Linux-x86/armadillo] Error 1
make[2]: Leaving directory `/home/atx/NetBeansProjects/armadillo'
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory `/home/atx/NetBeansProjects/armadillo'
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 136ms)
解决方法:
我知道这是一个老问题,但最近我遇到了麻烦,所以如果有人遇到和我一样的问题,我想帮忙.这是如何在64位Windows 7上的NetBeans C中设置Armadillo库.
>从http://arma.sourceforge.net/download.html下载最新版本的Armadillo
>在任何您想要的目录中将其解压缩.
>转到Netbeans – >项目属性 – > C编译器
3.1包括目录 – >找到您的Armadillo目录并选择文件夹“include”.
3.2预处理器定义 – > ARMA_USE_LAPACK ARMA_USE_BLAS
>转到Netbeans – >项目属性 – >链接
4.1附加图书馆目录 – >找到您的Armadillo目录并选择文件夹“examples / lib_win64”.
4.2附加依赖性 – > lapack_win64_MT.lib blas_win64_MT.lib
>转到项目的文件夹并添加Armadillo / examples / lib_win64中的文件.应添加4个文件 – > blas_win64_MT.dll,blas_win64_MT.lib,lapack_win64_MT.dll和lapack_win64_MT.lib.
这应该是它.现在你可以在C中使用Armadillo库,只需添加你的cpp #include,如果你想使用命名空间arma;
我希望这可以帮到你!干杯!
标签:c,netbeans,armadillo 来源: https://codeday.me/bug/20190902/1788386.html