1
如果我不包括<lapacke.h>
,我得到以下错误:lapacke与boost有冲突吗?
test.cpp:20:23: error: ‘LAPACK_ROW_MAJOR’ was not declared in this scope
LAPACKE_dsyev(LAPACK_ROW_MAJOR, jobz, uplo, N, &a[0], lda, &work[0]);
^
test.cpp:20:76: error: ‘LAPACKE_dsyev’ was not declared in this scope
LAPACKE_dsyev(LAPACK_ROW_MAJOR, jobz, uplo, N, &a[0], lda, &work[0]);
然而,当我包括<lapacke.h>
,我得到的错误与boost
冲突的一个长长的清单。我相信这是包括<boost/algorithm/string.hpp>
,因为这是我使用的唯一的boost
项目。
与lapacke
和boost
有冲突吗?当我离开<boost/algorithm/string.hpp>
它编译好,但更广泛的代码依赖于该包含。
此问题的一个最小的例子如下:
test.h:
#include <lapacke.h>
#include <boost/algorithm/string.hpp>
#include <vector>
TEST.CPP:
#include "test.h"
void eig(std::vector<double> A, std::vector<double>& evecs, std::vector<double>&evals) {
int N = (int)A.size();
if(N == 6) {
/// A is a 3x3 symmetric tensor
char jobz = 'V';
char uplo = 'L';
int N = 3;
int lda = 3;
int lwork = 15;
double work[lwork];
double a[9] = {
A[0], A[3], A[4],
A[3], A[1], A[5],
A[4], A[5], A[2]
};
LAPACKE_dsyev(LAPACK_ROW_MAJOR, jobz, uplo, N, &a[0], lda, &work[0]);
evals[0] = work[0];
evals[1] = work[1];
evals[2] = work[2];
for(int i = 0; i < 9; i++) {
evecs[i] = a[i];
}
} else {
fprintf(stderr, "ERROR: Unknown size of A in eig\n");
}
}
int main(int argc, char** argv) {
return 0;
}
生成文件:
all: test.exe
CC=g++ -std=c++11
OPTS= -O3 -Wall
LIBS= -lm -L/usr/lib/lapack -llapacke -llapack -lblas -lcblas
test.exe: $(OBJS) test.cpp
$(CC) $(OBJS) $(DEFS) $(OPTS) test.cpp -o test.exe $(LIBS)
clean:
rm -rf *.o
你能举一个你看到的错误的例子吗? –