Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8075081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:52:22+00:00 2026-06-05T14:52:22+00:00

Are there any circumstances in which it is acceptable to omit function declarations from

  • 0

Are there any circumstances in which it is acceptable to omit function declarations from source files? I have a C project which will not compile, and I do not know why. As far as I can determine the compiler (GCC 4.4.1) cannot find the declaration of the ‘sepData’ typedef when it gets to the declaration of the function ‘sysData’ in ‘system.h’.

From sepsis.h

typedef struct {
    int16 intensity;
    int16 offset;
} sepData;

From sepsis.c

sepData sepR, sepIR;

From system.h

void sysData(sepData *sepR, sepData *sepIR);

From system.c

#include "system.h"
#include "sepsis.h"

extern sepData sepR, sepIR;

void sysData(sepData *sepR, sepData *sepIR)
{
}

If I remove the declaration of ‘sysData’ from ‘system.h’, then the project compiles without error. Not knowing a great deal about C, I thought that including such declarations was compulsory. Is anyone able to explain what is going on here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T14:52:24+00:00Added an answer on June 5, 2026 at 2:52 pm
    #include "system.h"
    #include "sepsis.h"
    

    If system.h does not #include "sepsis.h" itself, then the type sepData will not be known when you prototype the sysData() function, and you get the error message. You can probably paper over this problem by swapping the order of the two headers:

    #include "sepsis.h"
    #include "system.h"
    

    But that only fixes this specific compilation unit. If you have other compilation units in this application, you’ll need to care about the order of #include lines, which gets tiresome. Perhaps system.h needs to #include "sepsis.h" itself — and have sepsis.h guard against multiple inclusion via the usual incantation:

    #ifndef _SEPSIS_H_
    #define _SEPSIS_H_
    ...
    #endif // _SEPSIS_H_
    

    Your codebase was able to compile without the sysData() prototype because you hadn’t used the function before the function’s declaration. Had you used the function before declaration, I expect the compiler would have given you a warning message and assumed every single argument should be an int and the return type should also be an int. (The old K&R rules.) This would, of course, not work, but it might not be obvious why it doesn’t work. (Yay C.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As a general rule, are there ever any circumstances in which it's acceptable for
Are there any circumstances in which Class.getDeclaringClass could give a different result from Class.getEnclosingClass
Are there any circumstances under which a ThreadPoolExecutor.CallerRunsPolicy will throw a RejectedExecutionException ? It
Are there any circumstances in which it is legitimate for a derived class to
Are there any circumstances where it is favourable to manually create a stub type,
Is there any way I can set a formatter on models that will convert
Is there any way we can fetch X509 Public Cetrificates using c# from AD
Due to circumstances not fully under my control, I have to develop ACCESS queries
I have an app which stores some data in .php files in /library/ directory,
I have a c++ dll which I need to debug. Due to the circumstances

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.