编译 C++ 代码时出现此错误:
Getting this error while compiling C++ code:
undefined reference to `__stack_chk_fail'
已经尝试过的选项:
详细错误:
/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<char, std::char_traits<char>, std::allocator<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)':
: undefined reference to `__stack_chk_fail'
amInfo(GRB_StringParam, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)':
: **undefined reference to `__stack_chk_fail'**
早些时候,我收到了 10 个这样的错误.发现我使用的预编译库的 gcc
和我用来编译代码的 gcc
版本之间存在版本不匹配.更新了 gcc
,现在我只收到了其中的 2 个错误.
Earlier, I was getting 10's of such errors. Found out that there was a version mismatch between the gcc
of the pre-compiled libraries I am using and the gcc
version I was using to compile the code. Updated gcc
and now I am getting only 2 of these errors.
有什么帮助吗?
libgurobi_c++.a 是用 -fno-stack-protector 编译的(显然).
libgurobi_c++.a was compiled with -fno-stack-protector (obviously).
想到一些事情:
这篇关于对 `__stack_chk_fail' 的未定义引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!