gpt4 book ai didi

c++ - 在 macOS Sierra 上使用 Qt 的 Dlib C++ 库

转载 作者:搜寻专家 更新时间:2023-10-31 02:13:49 24 4
gpt4 key购买 nike

我在 macOS Sierra 上使用带有 Qt 的 dlib c++ 库。我可以从终端编译所有示例,并使用 Qt 编译一些示例。但是,编译一些示例,例如使用 Qt 进行优化会抛出以下链接器错误:

Undefined symbols for architecture x86_64:
"_cblas_daxpy", referenced from:
dlib::blas_bindings::cblas_axpy(int, double, double const*, int, double*, int) in main.o
"_cblas_ddot", referenced from:
dlib::blas_bindings::cblas_dot(int, double const*, int, double const*, int) in main.o
"_cblas_dgemv", referenced from:
dlib::blas_bindings::cblas_gemv(dlib::blas_bindings::CBLAS_ORDER, dlib::blas_bindings::CBLAS_TRANSPOSE, int, int, double, double const*, int, double const*, int, double, double*, int) in main.o
"_cblas_dger", referenced from:
dlib::blas_bindings::cblas_ger(dlib::blas_bindings::CBLAS_ORDER, int, int, double, double const*, int, double const*, int, double*, int) in main.o
"_cblas_dscal", referenced from:
dlib::blas_bindings::cblas_scal(int, double, double*) in main.o
"_cblas_dtrsm", referenced from:
dlib::blas_bindings::cblas_trsm(dlib::blas_bindings::CBLAS_ORDER, dlib::blas_bindings::CBLAS_SIDE, dlib::blas_bindings::CBLAS_UPLO, dlib::blas_bindings::CBLAS_TRANSPOSE, dlib::blas_bindings::CBLAS_DIAG, int, int, double, double const*, int, double*, int) in main.o
"_dgetrf_", referenced from:
dlib::lapack::binding::getrf(int, int, double*, int, int*) in main.o
"_dpotrf_", referenced from:
dlib::lapack::binding::potrf(char, int, double*, int) in main.o
"_dsyevr_", referenced from:
dlib::lapack::binding::syevr(char, char, char, int, double*, int, double, double, int, int, double, int*, double*, double*, int, int*, double*, int, int*, int) in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我还在 .pro 文件中包含:LIBS += -L/usr/local/lib\-ldlib\

在安装 LAPACK、BLAS 和 CBLAS 并在 .pro 中包含 -lblas 和 -llapack 之后,除了上述错误之外,我还遇到了这个错误:

warning: object file (/usr/local/lib/liblapack.a(iladlr.o)) was built for newer OSX version (10.12) than being linked (10.8)
Undefined symbols for architecture x86_64:
"__gfortran_concat_string", referenced from:
_dormtr_ in liblapack.a(dormtr.o)
_dormql_ in liblapack.a(dormql.o)
_dormqr_ in liblapack.a(dormqr.o)
"__gfortran_st_write", referenced from:
_xerbla_ in libblas.a(xerbla.o)
"__gfortran_st_write_done", referenced from:
_xerbla_ in libblas.a(xerbla.o)
"__gfortran_stop_string", referenced from:
_xerbla_ in libblas.a(xerbla.o)
"__gfortran_string_len_trim", referenced from:
_xerbla_ in libblas.a(xerbla.o)
"__gfortran_transfer_character_write", referenced from:
_xerbla_ in libblas.a(xerbla.o)
"__gfortran_transfer_integer_write", referenced from:
_xerbla_ in libblas.a(xerbla.o)

最佳答案

看来新的 macOS 已经有了 LAPACK。您只需要在 .pro 文件中包含 -lcblas 和 -lclapack。您可以在/usr/lib 或/usr/local/lib 中找到它们。

如果在/usr/lib 中:

LIBS += -L/usr/lib\
-lcblas\
-lclapack\
-L/usr/local/lib\
-ldlib\

如果在/usr/local/lib 中

LIBS += -L/usr/local/lib\
-lcblas\
-lclapack\
-ldlib\

关于c++ - 在 macOS Sierra 上使用 Qt 的 Dlib C++ 库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40751103/

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