我试图从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
我不知道该怎么做。