Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to turn on all the warning in gcc while using visual studio code?

Recently i came across a problem written in C where there was some undefined behaviour due to which there was some segmentation error. While other people who helped me debugging it were getting warnings from their compiler which was GCC too but in my case while running that same problem in visual studio code it gives no warnings and not even a single errors and sadly no output. The execution starts and then closes own its own in the terminal.
And I use Windows 11.

I want this kinds of warnings.
People who helped me got this kind of warnings

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Firstly you should check if you are running the latest version of GCC.
If still doesn’t show you the error messages then you should try adding -Wall -Wextra when you compile, like this:

gcc main.cpp -o executable.exe -Wall -Wextra

Those options tell compiler to be more strict and show you more warnings. You can see what exactly they do on this page

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading