安装 spams 这个软件时报错
In file included from /....../R/R-3.3.0/mybuild/lib64/R/include/R.h:43,
from spams.cpp:1277:
/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/cmath:81: error: template with C linkage
解决方法:
找到提示错误的源代码spams/src/spams.cpp,1277行。这里它引用了安装的R路径下的R.h头文件,R.h又引用了系统gcc安装下的cmath。不知道哪里冲突了。
extern "C" {
#include <R.h>
#include <Rinternals.h>
#include <Rdefines.h>
#include <R_ext/Rdynload.h>
#include <Rembedded.h>
#ifndef WIN32
#include <Rinterface.h>
#endif
#include <R_ext/RS.h>
#include <R_ext/Error.h>
}
#include "spams.h"
试着将extern "C"注释带掉
//extern "C" {
#include <R.h>
#include <Rinternals.h>
#include <Rdefines.h>
#include <R_ext/Rdynload.h>
#include <Rembedded.h>
#ifndef WIN32
#include <Rinterface.h>
#endif
#include <R_ext/RS.h>
#include <R_ext/Error.h>
//}
#include "spams.h"
在尝试安装spams软件时遇到了错误:template with C linkage。错误源于R.h头文件引用了系统gcc的cmath,导致冲突。解决办法是检查并修改spams源代码spams.cpp中涉及的R.h引用。
776

被折叠的 条评论
为什么被折叠?



