2

I am writing a project in C using GCC 4.8 and I would like to see all the warnings (hoping to eliminate them) but the problem is I am #including some old, not maintained library which gives me huge wall of warnings in reaction to -Wall option. There is no way I fix those and I just want to ignore it focusing on code I actually write/maintain.

So can I:

gcc -Wall-excluding-OldBlackBox.c -myproject.c ?
6
  • 1
    stackoverflow.com/questions/1079997/… Commented Sep 4, 2013 at 19:30
  • @AdamBurry not ontopic, that article is about doing it through #pragmas, and here he asks for doing that through gcc parameters Commented Sep 4, 2013 at 19:31
  • @Zupoman unfortunately I do not think the flag he wants exists. Commented Sep 4, 2013 at 19:34
  • @Adam Burry - doing this by #pragmas would be good enough but I can't see an option to disable specific files (and not only kind of warnings) anywhere in answers to the thread you linked. Or maybe I can just disable all the warnings at the beginning and enable them back at the end of the blackbox.c file ? Commented Sep 4, 2013 at 19:38
  • Are you really #including one .c file in another? That's almost never a good idea. Commented Sep 4, 2013 at 20:04

2 Answers 2

2

Update your makefile so that you have a different gcc -Wxxx line for different files (or groups of files)

result.exe : xxx.o yyy.o
   gcc -o result.exe xxx.o yyy.o

xxx.o : xxx.c
   gcc -Wall xxx.c

yyy.o : yyy.c
   gcc -W yyy.c
Sign up to request clarification or add additional context in comments.

1 Comment

Well I don't have a make file right now (amateur Windows programmer with bad habits) but it may be reason good enough to make one :)
1

first create individual object files and then link them as single Executable.

//compilation with warnings        and   compilation without warnings  
gcc -Wall file1.c file2.c -o foo.o && gcc -w file3.c file4.c -o foo1.o 


gcc -o final foo.o foo1.o

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.