问题描述
我正在尝试在Java代码中使用SHTOOLS Fortran子例程。为此,我正在实现JNI并使用shtools.h标头调用SHTOOLS。在Mac OS X上,这工作得很好。我需要在Windows上做同样的事情,但是在安装/使用FFTW和LAPACK / BLAS库时遇到了问题。编译和链接很好,但是程序在运行时终止。因此,我认为编译这些(fftw,lapack)库的方式存在问题,因此我决定最好使用具有所有3个库的Intel mkl套件。我使用cygwin编译了SHTOOLS,并在Visual Studio中将路径设置为/ src和/ lib。我试图在Visual Studio 2019中编译以下代码
#include <iomanip>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
#include "shtools.h"
using namespace std;
int main() {
int lmax = 7;
int exitstatus;
vector<double> zero(lmax + 1);
vector<double> w(lmax + 1);
const int normaliastion = 4;
const int cphase = -1;
shtools::SHGLQ(lmax,&zero[0],&w[0],nullptr,&normaliastion,&cphase,&exitstatus);
for (int i = 0; i < lmax + 1; i++) {
cout << zero.at(i) << " ";
}
cout << endl;
for (int i = 0; i < lmax + 1; i++) {
cout << w.at(i) << " ";
}
}
我收到以下错误
1>shtoosltest.cpp
1>C:\Users\nrsha\Desktop\New\SHTOOLS\src\shtools.h(49): error : expected a ")"
1> void SHExpandDHC(const double _Complex *grid,const int grid_d0,1> ^
,无论在何处调用_Complex,都有其他一些类似的错误。因为无论如何我都不需要复杂,所以我只是在shtools.h中注释了所有复杂调用方法,以查看它是否可以编译。这次它引发了以下错误:
1>------ Build started: Project: Project2,Configuration: Debug x64 ------
1>shtoosltest.cpp
1>shtoosltest.obj : : error LNK2019: unresolved external symbol SHGLQ referenced in function main
1>C:\Users\nrsha\source\repos\Project2\x64\Debug\Project2.exe : : error LNK1120: 1 unresolved externals
1>Done building project "Project2.vcxproj" -- Failed.
========== Build: 0 succeeded,1 Failed,0 up-to-date,0 skipped ==========
所以,我认为这是因为我正在使用GNU编译的SHTOOLS库。在使用英特尔编译器编译SHTOOLS或使用Visual Studio对其进行编译时,我需要一些帮助。任何帮助表示赞赏。如果您有更简单的方法来实现自己的目标,请告诉我。预先谢谢您,保持健康?。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)