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 6476473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:49:48+00:00 2026-05-25T06:49:48+00:00

I have Preprocessor.h #define MAX_FILES 15 struct Preprocessor { FILE fileVector[MAX_FILES]; int currentFile; };

  • 0

I have
Preprocessor.h

#define MAX_FILES 15

struct Preprocessor {
    FILE fileVector[MAX_FILES];
    int currentFile;
};

typedef struct Preprocessor Prepro;

void Prepro_init(Prepro* p) {
    (*p).currentFile = 0;
}

I realized then that I had to separate declarations from definitions. So I created Preprocessor.c:

#define MAX_FILES 15

struct Preprocessor {
    FILE fileVector[MAX_FILES];
    int currentFile;
};

typedef struct Preprocessor Prepro;

And Preprocessor.h is now:

void Prepro_init(Prepro* p) {
    (*p).currentFile = 0;
}

That obviously, doesn’t work because Pr..h doesn’t know Prepro type. I already tried several combinations, none of them worked. I can’t find the solution.

  • 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-05-25T06:49:48+00:00Added an answer on May 25, 2026 at 6:49 am

    Move the typedef struct Preprocessor Prepro; to the header the file and the definition in the c file along with the Prepro_init definition. This is will forward declare it for you with no issues.

    Preprocessor.h

    #ifndef _PREPROCESSOR_H_
    #define _PREPROCESSOR_H_
    
    #define MAX_FILES 15
    
    typedef struct Preprocessor Prepro;
    
    void Prepro_init(Prepro* p);
    
    #endif
    

    Preprocessor.c

    #include "Preprocessor.h"
    
    #include <stdio.h>
    
    struct Preprocessor {
        FILE fileVector[MAX_FILES];
        int currentFile;
    };
    
    void Prepro_init(Prepro* p) {
        (*p).currentFile = 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following preprocessor divective: #ifndef NDEBUG #define TRACE printf #else #define TRACE(...)
Let's say I have a source file with many preprocessor directives. Is it possible
I have this preprocessor directive: #define INDEXES_PER_SECTOR BYTES_PER_SECTOR / 4 where BYTES_PER_SECTOR is declared
I have an Inno Setup script with preprocessor directives ( #define s, #if s,
I want to have a C pre-preprocessor which is filtering some #define statements from
I have a C program below: #define f(g,g2) g##g2 main() { int var12=100; printf(%d,f(var,12));
I set this in a .h file: #define ID_ACTIVE 2 then used this in
Languages like C and even C# (which technically doesn't have a preprocessor) allow you
In general, I occasionally have a chain of nested macros with a few preprocessor
I would like to add a preprocessor to HTML pages. Basically, I have a

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.