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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:27:12+00:00 2026-05-27T00:27:12+00:00

Well, I have a header (my_prog.h) which looks like this: #ifndef __MY_HEADER_H #define __MY_HEADER_H

  • 0

Well, I have a header (my_prog.h) which looks like this:

#ifndef __MY_HEADER_H
#define __MY_HEADER_H
#include <stddef.h>
typedef struct {
    size_t something;
    size_t something_else;
}
void my_func();
#endif

and implementation file (my_prog.c) where I put:

#include "my_prog.h"
static size_t min(size_t a, size_t b) {...}
void my_func() {...}

When I try to compile my_prog.c to object file (I need it for linking with other files) I fet:

error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘min’

The command I use for compiling is:

gcc -c my_prog.c -o my_prog.h

There’s no error saying that it couldn’t find the source. When I include in implementation file it compiles wihtout issues.

  • 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-27T00:27:13+00:00Added an answer on May 27, 2026 at 12:27 am
    1. Remove the ... from the function body. Having them is a syntax error.

    2. You have not given a typedef name to the structure and the ; is missing:

      typedef struct {
          size_t something;
          size_t something_else;
      } foo;
        ^^^^
      
    3. In the compile line, following the -o you are specifying the name of your header file. This is incorrect. If the compilation goes fine(it will if you fix 1 and 2 above) , the compiler the wipe the original contents of my_prog.h and will overwrite it with the object file. Instead do :

      gcc -c my_prog.c -o my_prog.o
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

well i have a configuration like this in the components part of my config
So I have a header file which has function implementations in it as well
I have header.php and footer.php files which I include in all of my pages.
Well i have a div tag that i show as a modal dialog this
I have a header which is showed on all my pages. In that header
Well I cant figure this one out, it looks fine in Firefox, Chrome, Safari
Well I have a view of this type of hierarchy Main View (having some
Let's say I have a header file called inclusions.h that has all the #include
In my header, I have this CSS specified. a:link { -moz-transition: all 0.2s ease-in-out;
I have a header-container with a background image, like so: #header-container { background:url(../img/bg.jpg) repeat-x

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.