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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:35:32+00:00 2026-05-18T12:35:32+00:00

Hopefully this is a straightforward question… Here’s my process to reproduce this issue. First

  • 0

Hopefully this is a straightforward question… Here’s my process to reproduce this issue. First I create my source file:

bash $ cat t.c
#include "t.h"

int main()
{
  ABC abc;
}

Then I create my corresponding header file:

bash $ cat t.h
#ifdef _T_H
#define _T_H

#ifdef __cplusplus
extern "C" {
#endif

typedef struct abc { 
  int a;
} ABC;

#ifdef __cplusplus
}
#endif

#endif

Then, I try to compile it:

bash $ gcc -o t t.c
t.c: In function ‘main’:
t.c:5: error: ‘ABC’ undeclared (first use in this function)
t.c:5: error: (Each undeclared identifier is reported only once
t.c:5: error: for each function it appears in.)
t.c:5: error: expected ‘;’ before ‘abc’

What is going on? If I use ‘struct abc’ instead of ‘ABC’ as the type in t.c, then it does compile. Why aren’t the typedefs working?

  • 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-18T12:35:32+00:00Added an answer on May 18, 2026 at 12:35 pm

    Try:

    #ifndef _T_H
    #define _T_H
    

    I happened to notice this because the _T_H didn’t line up, and my subconscious brain knew it should.

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

Sidebar

Related Questions

Hopefully this should be a fairly straightforward question, I just don't know enough about
This is hopefully a fairly straightforward question. I am building a generic search form
Still pretty new to ObjectiveC and Cocoa here. Hopefully the answer to this question
Hopefully this question isn't as subjective as I think it may be. I have
This is probably (hopefully) a pretty simple question, but I can't seem to get
Am quite new to namespacing etc so hopefully this will be straightforward. I have
Hopefully this is an easy/dumb question. I am redirecting program input and output to
Hopefully someone can shed some light on this 'seemingly' straight forward issue. I need
Hopefully this is a quick and easy question to answer. Do I need the
I couldn't find any straightforward answer to my question, hopefully you guys can! I've

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.