scope and linkage



I'm working on a disassembler for a school project.

Things work but I get compiler warnings as follows:
cc -W -Wall -pedantic -ansi main.c
defs.h:44: warning: 'blah' defined but not used

blah is a static variable, so visible only to defs.h (and files that
include defs.h?).
Without the static qualifier the compiler bails with
main.o: multiple definition of 'blah'
main.o: first defined here
collect2: ld returned 1 exit status
make: *** [all] Error 1


The warnings are invisible w/o the -Wall compile flag.
I just want to know if there is a way to declare 'blah' that will avoid
the warning.

here is the program structure:

FILE: main.c
#include dis.h
/* only calls one function in dis.h */

FILE: dis.h
#include defs.h

FILE: dis.c
#include dis.h
/* uses almost everything in defs.h */

FILE: defs.h
static const char* blah[ SIZE ] = { ... };


Like I said, I'm just looking to compile cleanly with the CFLAGS above.
thanks for any help!

.



Relevant Pages

  • Re: scope and linkage
    ... Things work but I get compiler warnings as follows: ... defs.h:44: warning: 'blah' defined but not used ... The warnings are invisible w/o the -Wall compile flag. ... Boeing Associate Technical Fellow ...
    (comp.lang.c)
  • Re: Is it standard and practical to use long long types?
    ... > right option for putting the compiler in conforming mode. ... > compiler is invoked with the extensions disabled, ... Bogus/idiotic warnings when all warnings are enabled. ... GCC does not fully support C99, yet ansi invokes it's C99 spirit. ...
    (comp.lang.c)
  • Re: Is it standard and practical to use long long types?
    ... > right option for putting the compiler in conforming mode. ... > compiler is invoked with the extensions disabled, ... Bogus/idiotic warnings when all warnings are enabled. ... GCC does not fully support C99, yet ansi invokes it's C99 spirit. ...
    (comp.lang.cpp)
  • Re: Tcl 8.5 HP/UX Compiler warnings
    ... results and "the optional HP ANSI C compiler", ... stat64 struct pointers are being ... The elementary types of the structure ... other warnings I cited are similarly harmless. ...
    (comp.lang.tcl)
  • Re: Is it standard and practical to use long long types?
    ... right option for putting the compiler in conforming mode. ... Bogus/idiotic warnings when all warnings are enabled. ... For reference, this what I get from gcc, when invoked in conforming mode ...
    (comp.lang.cpp)