다음 C ++ 코드를 컴파일 할 때 오류가 발생합니다.
# include <iostream>
# include <armadillo>
using namespace arma;
using namespace std;
int main() {
mat A;
mat B;
mat C;
// Populating the matrices with random numbers
A.randu(3,3);
B.randu(3,3);
// Matrix multiplication
C = A * B;
cout << "Mutliplying matrices A and B:" << endl;
cout << "A * B = " << C << endl;
return 0;
}
다음은 g ++로 컴파일 할 때 내 오류입니다.
아키텍처 x86_64에 대한 정의되지 않은 기호 : "_wrapper_dgemm_", 참조 :
void arma::blas::gemm<double>(char const*, char const*, int const*, > int const*, int const*, double const*, double const*, int const*, double > const*, int const*, double const*, double*, int const*) in >armadillo_playground-aa3649.o
"_wrapper_dgemv_", 다음에서 참조 :
void arma::blas::gemv<double>(char const*, int const*, int const*, >double const*, double const*, int const*, double const*, int const*, >double const*, double*, int const*) in armadillo_playground-aa3649.o
ld : 아키텍처 x86_64에 대한 기호를 찾을 수 없음 clang : 오류 : 링커 명령이 종료 코드 1로 실패했습니다 (> 호출을 보려면 -v 사용).
행렬 곱셈 '*'를 '+', '%'등으로 바꾸면 코드가 불만없이 컴파일됩니다.
미리 감사드립니다!
오류는 올바르게 빌드하여 극복 할 수 있는 간단한 링커 오류입니다. 정확히 필요한 것은 시스템 / OS에 따라 다르지만 (모두 문서화되어 있음) 내 Linux 상자에서는 작동합니다.
edd@max:/tmp$ g++ -o arma arma.cpp -larmadillo
edd@max:/tmp$ ./arma
Mutliplying matrices A and B:
A * B = 1.0574 1.0356 1.5178
1.1368 1.3434 1.4919
0.7028 0.6516 1.0423
edd@max:/tmp$
여기 arma.cpp
에 예제가 포함 된 파일이 있습니다. libarmadillo.so
LAPACK 및 BLAS 라이브러리에 연결 되므로 라이브러리 만 연결하면 충분합니다. 다른 OS는 사용 패턴이 다를 수 있습니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다