linux 'stack'未声明(在此函数内第一次使用,未定义的引用`__stack_chk_fail'

编译C++代码时出现此错误:

undefined reference to `__stack_chk_fail'

已尝试的选项:

在编译时添加-fno-stack-protector - 不起作用,错误仍然存​​在

在我的代码中添加了一个void __stack_chk_fail(void)的虚拟实现.仍然得到同样的错误.

详细错误:

/u/ac/alanger/gurobi/gurobi400/linux64/lib/libgurobi_c++.a(Env.o)(.text+0x1034): In function `GRBEnv::getPar/u/ac/alanger/gurobi/gurobi400/linux64/lib/libgurobi_c++.a(Env.o)(.text+0x1034): In function `GRBEnv::getParamInfo(GRB_StringParam, std::basic_string, std::allocator >&, std::basic_string, std::allocator >&)':

: undefined reference to `__stack_chk_fail'

amInfo(GRB_StringParam, std::basic_string, std::allocator >&, std::basic_string, std::allocator >&)':

: **undefined reference to `__stack_chk_fail'**

早些时候,我得到了10个这样的错误.发现gcc我正在使用的预编译库和gcc我用来编译代码的版本之间存在版本不匹配.更新了gcc,现在我只收到其中2个错误.

有什么帮助吗?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值