Talk to GCC (fourth: GCC warning)

Source: Internet
Author: User


Hello, everyone, crossing, last time we were talking about GCC compilation-related content. This time let's talk about how to use GCC to issue a warning, free

The words go forward, and the words return to the positive. Let's talk about GCC together!


Crossing, GCC has the ability to compile warnings. What is a compile warning? There are crossing questions under the table. The so-called compile warning is that the compiler

Some content that does not conform to the compilation rules but conforms to the compiler syntax is given a warning during the translation process. I'm using a real-life example to give you

Make a metaphor: everyone has seen the football game, the referee in the football match holding a yellow and red color cards. Players in the game

Violations of the rules of the game often occur, if the player violates the rules will not bring serious consequences for the game, then the referee will show the players

Yellow. If a player violates a rule that will have serious consequences for the game, the referee will show the player a red card. The yellow card in the football match is good.

A red card is a compilation error in GCC than a compilation warning in GCC. GCC issues a compilation warning, but it can continue compiling. GCC issued

Compile error, then it will stop compiling.


By default, GCC turns on the compile warning feature, but only contains some basic warning information that we can use with GCC options

Let GCC emit more and more compilation warnings during the compilation process.


The option WalL allows GCC to issue more warnings. Example: Gcc-wall file.c-o F.O

option Werror allows GCC to treat warnings as errors, and option wall will allow GCC to issue more warnings, but won't let GCC stop

Compile. Option Werror will cause GCC to stop compiling when a warning occurs.


Crossing, warning messages, also useful information, because there may be some potential errors in the warning. So when using GCC, try to open the police

Warning messages generated at compile time, and modify them until no compile warning is generated.


Crossing, here's what we're going to say about GCC today. Want to know how to funeral, and listen to tell!


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Talk to GCC (fourth: GCC warning)

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.