安装软件spams时报错error: template with C linkage

在尝试安装spams软件时遇到了错误:template with C linkage。错误源于R.h头文件引用了系统gcc的cmath,导致冲突。解决办法是检查并修改spams源代码spams.cpp中涉及的R.h引用。

安装 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编译、安装通过了。



评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值