나는 다음과 같은 온라인 라이브러리를 사용하는 .CPP 코드를 만들었습니다.컴파일 - - 포트란 코드로 연결 MEX 파일
내 코드에서 .mex 파일을 만들고 싶습니다. 내가 입력하고 때 :
이러한 오류가 발생 내 기능의Error using mex
/tmp/mex_7456790284416_24518/GUSTAVsolution.o: In function `MIEsolution::Spherical_Hankel_function(unsigned int,
std::complex<double>, int)':
GUSTAVsolution.cpp:(.text+0x18c): undefined reference to `zbesh_wrap'
GUSTAVsolution.cpp:(.text+0x28e): undefined reference to `zbesh_wrap'
/tmp/mex_7456790284416_24518/GUSTAVsolution.o: In function `MIEsolution::Spherical_Bessel_function_2k(unsigned int,
std::complex<double>)':
GUSTAVsolution.cpp:(.text+0x3dc): undefined reference to `zbesy_wrap'
GUSTAVsolution.cpp:(.text+0x53d): undefined reference to `zbesj_wrap'
/tmp/mex_7456790284416_24518/GUSTAVsolution.o: In function `MIEsolution::Spherical_Bessel_function_1k(unsigned int,
std::complex<double>)':
GUSTAVsolution.cpp:(.text+0x7a0): undefined reference to `zbesj_wrap'
GUSTAVsolution.cpp:(.text+0x907): undefined reference to `zbesy_wrap'
/tmp/mex_7456790284416_24518/GUSTAVsolution.o: In function
`MIEsolution::Differentation_Spherical_Hankel_function(unsigned int, std::complex<double>, int)':
GUSTAVsolution.cpp:(.text+0xb32): undefined reference to `zbesh_wrap'
GUSTAVsolution.cpp:(.text+0xc4f): undefined reference to `zbesh_wrap'
GUSTAVsolution.cpp:(.text+0xd30): undefined reference to `zbesh_wrap'
GUSTAVsolution.cpp:(.text+0xe4d): undefined reference to `zbesh_wrap'
/tmp/mex_7456790284416_24518/GUSTAVsolution.o: In function
`MIEsolution::Differentation_Spherical_Bessel_function(unsigned int, std::complex<double>, int)':
GUSTAVsolution.cpp:(.text+0xfb8): undefined reference to `zbesj_wrap'
GUSTAVsolution.cpp:(.text+0x112b): undefined reference to `zbesy_wrap'
GUSTAVsolution.cpp:(.text+0x1303): undefined reference to `zbesj_wrap'
GUSTAVsolution.cpp:(.text+0x1476): undefined reference to `zbesy_wrap'
GUSTAVsolution.cpp:(.text+0x161a): undefined reference to `zbesy_wrap'
GUSTAVsolution.cpp:(.text+0x1787): undefined reference to `zbesj_wrap'
GUSTAVsolution.cpp:(.text+0x1935): undefined reference to `zbesy_wrap'
GUSTAVsolution.cpp:(.text+0x1aa2): undefined reference to `zbesj_wrap'
collect2: error: ld returned 1 exit status
하나는 :
이complex<double> MIEsolution::Spherical_Bessel_function_2k(unsigned n,complex<double> z){
complex<double> Sb2k;
Sb2k = sph_besselY(n, z);
return Sb2k;
}
요점은이 라이브러리는 일부 연결되어
mex GUSTAVsolution.cpp
매트랩 다음과 같은 오류를 제공합니다 Fortran 코드와 C++. 예를 들어, sph_besselY
함수는 해당 포트란 코드 zbesy_wrap
을 호출합니다.
저는 Fortran 함수를 어떻게 든 컴파일한다고 가정합니까? 웹 페이지와 동일한 방법으로 라이브러리를 설치했습니다. 또한, 나는 그렇게, 내 코드 라이브러리를 수입하고 여기 제안
#include <complex_bessel.h>
링커 명령 표시 ... 컴파일 된 C를 컴파일 된 Fortran과 링크합니다. 컴파일러 스위치 또는 BIND (C ...)와 함께 작동하는 밑줄과 같은 기호 문제가 있습니다. fortran에는 USE ISO_C_BINDING이 있습니다. 당신은 아마도 간단한 예를 원할 것입니다. 포트란에 BESSEL 함수가 내장되어 있습니다 ... – Holmz