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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:29:43+00:00 2026-06-06T01:29:43+00:00

For some reason this line of code is giving me quite a problem. struct

  • 0

For some reason this line of code is giving me quite a problem.

struct socketaddr_in clientaddr;

The error message is:

tiny.c:23:24: error: storage size of ‘clientaddr’ isn’t known

If I remove that line of code I get the following error message:

s2s2@s2s2-ThinkPad-T61:~/Documents/Cprogramming/web_server$ make
gcc -std=gnu99 -O2 -lpthread -lrt -o server tiny.c csapp.c
/tmp/ccVxw07i.o: In function `Pthread_create':
csapp.c:(.text+0x7e5): undefined reference to `pthread_create'
/tmp/ccVxw07i.o: In function `Pthread_cancel':
csapp.c:(.text+0x805): undefined reference to `pthread_cancel'
/tmp/ccVxw07i.o: In function `Pthread_join':
csapp.c:(.text+0x825): undefined reference to `pthread_join'
/tmp/ccVxw07i.o: In function `Pthread_detach':
csapp.c:(.text+0x845): undefined reference to `pthread_detach'
/tmp/ccVxw07i.o: In function `Sem_init':
csapp.c:(.text+0x895): undefined reference to `sem_init'
/tmp/ccVxw07i.o: In function `P':
csapp.c:(.text+0x8b5): undefined reference to `sem_wait'
/tmp/ccVxw07i.o: In function `V':
csapp.c:(.text+0x8d5): undefined reference to `sem_post'
/tmp/ccVxw07i.o: In function `Pthread_once':
csapp.c:(.text+0x881): undefined reference to `pthread_once'
collect2: ld returned 1 exit status
make: *** [webServer-gcc] Error 1

Here are links to the csapp.c and csapp.h files.

Thanks for all the help.

  • 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-06T01:29:46+00:00Added an answer on June 6, 2026 at 1:29 am

    tiny.c:23:24: error: storage size of ‘clientaddr’ isn’t known

    There’s a reason you need to declare structs as struct structname instancename in C – that’s so that the C compiler knows how much memory to allocate – and possibly how to align that data, etc.

    This is the C compiler’s way of telling you no such struct socketaddr_in exists – it’d be sockaddr_in.

    A common way to work around the naming of structs in this way is to define them like this:

    typedef struct _struct_name
    {
        /* ... */
    } structname;
    

    then structname can be used as a type without the struct qualifier. You don’t have to do this on the definition of the struct, either, you could do it later.

    So, the short answer is socketaddr_in doesn’t exist as a struct in POSIX – it’s sockaddr_in.

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

Sidebar

Related Questions

Okay, so for some reason this is giving me a error as seen here:
For some reason this line of code. <a href=/API/@Html.DisplayFor(modelItem => item.site_url)>@Html.DisplayFor(modelItem => item.api_name)</a> is
For some reason, I'm getting this error message: Uncaught TypeError: Object #<an Object> has
For some reason, I'm getting this error message: Uncaught SyntaxError: Unexpected token < For
for some reason this code wont work, it doesn't seem to read the javascript.php
For some reason the following code is giving me an exception. <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries>
I have this line of code if ([[dateTextField text] isEqualToString:@Test]); { } For some
This might sound like a trivial problem but for some reason it is not.
For some reason this program is saying that 'switch' is not defined. What is
For some reason This php script won't echo anything: <?php setcookie(pop,'hi',time()+604800); echo $HTTP_COOKIE_VARS['pop']; ?>

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.