Thread: Help to remove the warning "x function defined but not used"

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Aug 2009
    Posts
    11

    Question Help to remove the warning "x function defined but not used"

    Hi all,

    I need a small help in removal of the warning "Function xxx is defined but not used".

    Actual Problem:
    =============
    There is a header file (say a.h) in which some functions are defined as static.

    This a.h file is included in 30 files.

    The object files of these 30 files are required to obtain the final output binary.

    There are only 3 files which uses all the static methods defined in a.h
    In remaining files only some of the static functions (defined in a.h) are used.

    When i compile the code with -Wall iam getting the warning :
    "function xxx defined but not used" for all of the unused static functions (defined in a.h)

    Reason for the warning:
    ==================
    We will get a local copy for each of the static methods when "a.h" file is included.(in c/cpp files)
    Only some of them (static functions) are used. So compiler issues warning for the un-used functions.

    Tried methods:
    ===========
    I tried by removing the static key-word for all the functions (for which the compiler issues warning).
    Then i was getting linker error:
    "There are multiple defnitions for function xxx".

    Could anyone suggest any way to remove these ("function xxx defined but not used") warnings?

    Thanks in advance....

    Regards,
    14341
    Last edited by 14341; 08-17-2009 at 07:15 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 05-13-2011, 08:28 AM
  2. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  3. Dev-cpp - compiler options
    By tretton in forum C Programming
    Replies: 7
    Last Post: 01-06-2006, 06:20 PM
  4. Replies: 18
    Last Post: 12-31-2005, 01:56 PM
  5. Compiler "Warnings"
    By Jeremy G in forum A Brief History of Cprogramming.com
    Replies: 24
    Last Post: 04-24-2005, 01:09 PM

Tags for this Thread