Warning: conflicting types for built-in function 'puts' Solution

Source: Internet
Author: User
Tags builtin


Warning: conflicting types for built-in function 'puts' solution [compiler version] arm-linux-gcc 3.4.1 [Problem description] www.2cto.com when developing the embedded underlying layer, I wrote a puts function, that is, sending a string to the Super Terminal through the serial port. However, the following problems occur during program Compilation: warning: conflicting types for built-in function 'puts' [Problem Analysis] in the C language standard, some common functions are defined as built-in functions (built-in functions), such as printf, puts, strchr, memset, and so on. These functions do not need to contain declarations in header files, you can compile and connect the function. However, if you want to implement it on your own, the conflict prompt shown above will appear. Sometimes you can use the function contained in www.2cto.com without including some header files. It may be that the compiler contains some common simple functions for processing, even if you do not include the header file, the compiler also knows where to find it, but if it is a complex function or a static library you write yourself, you must include it when you want to use it; it's just some simple functions you don't need to include header files. [Solution] 1. Add the-fno-builtin or-fno-builtin-FUNCTION option during compilation, and you can implement these functions without conflict. For example, in the above prompt, you can add-fno-builtin-puts during compilation to compile normally. 2. Change the names of these functions to avoid conflict.

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.