Compilation error & quot; undefinedreferenceto & quot; -- Linux general technology-Linux programming and kernel information. Read the following for details. Finally, I started compiling in GCC. HoHo and Make were just a while ago, and I got an error again:
Klib. c :(. text + 0xda): undefined reference to '_ stack_chk_fail'
It seems that _ stack_chk_fail has an undefined function reference? But we have never used this function? It seems that our program is not a problem. Let's see what we say online.
In some versions of gcc, the undefined reference to '_ stack_chk_fail' error often occurs during compilation. You can add-fno-stack-protector in CFLAGS of makefile.
In the MakeFile of our configuration file, add the CFLAGS
CFLAGS =-I./include/-c-fno-stack-protector
Here I also paste a later error. The error is as follows:
Undefined reference to 'memset'
Add the cflags parameter CFLAGS =-I./include/-c-fno-stack-protector-minline-all-stringops in cflags.
In this way, the compilation is successful. Most of these problems occur because of the default settings of some gcc versions. For example, this problem may occur when I use gcc 4.13 + ubuntu 7.10.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service