我正在尝试从 Mathematica 中调用 C 程序。我已经编译了 Wolfram Research 提供的 addtwo.c 示例
fayard@Speed:MathLink$ /Applications/Mathematica.app/SystemFiles/Links/MathLink/DeveloperKit/MacOSX-x86-64/CompilerAdditions/mcc --verbose addtwo.tm addtwo.c
/Applications/Mathematica.app/SystemFiles/Links/MathLink/DeveloperKit/MacOSX-x86-64/CompilerAdditions/mprep addtwo.tm -o a.out.tm.c
/usr/bin/clang -I/Applications/Mathematica.app/SystemFiles/Links/MathLink/DeveloperKit/MacOSX-x86-64/CompilerAdditions -arch i386 -arch x86_64 -c -o addtwo.o addtwo.c
/usr/bin/clang -I/Applications/Mathematica.app/SystemFiles/Links/MathLink/DeveloperKit/MacOSX-x86-64/CompilerAdditions -arch i386 -arch x86_64 -c -o a.out.tm.o a.out.tm.c
/usr/bin/clang++ -I/Applications/Mathematica.app/SystemFiles/Links/MathLink/DeveloperKit/MacOSX-x86-64/CompilerAdditions -arch i386 -arch x86_64 -o a.out addtwo.o a.out.tm.o -L/Applications/Mathematica.app/SystemFiles/Links/MathLink/DeveloperKit/MacOSX-x86-64/CompilerAdditions -lstdc++ -F /Applications/Mathematica.app/SystemFiles/Links/MathLink/DeveloperKit/MacOSX-x86-64/CompilerAdditions -framework mathlink -framework Foundation
不幸的是,当我尝试从 Mathematica 加载库时,我遇到了一个停顿,我发现我的应用程序崩溃了。在 ~/Library/Logs/DiagnosticReports 中,我从 addtwo 中遇到了崩溃
Application Specific Information:
dyld: launch, loading dependent libraries
Dyld Error Message:
Library not loaded: @executable_path/../Frameworks/mathlink.framework/Versions/4.25/mathlink
Referenced from: /Users/USER/Documents/*/addtwo
Reason: image not found
我不知道该怎么办。