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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:33:18+00:00 2026-05-20T15:33:18+00:00

Hello Everybody! I got the following error, while trying to test a code for

  • 0

Hello Everybody!

I got the following error, while trying to test a code for the game Clever Frog:
error: dereferencing pointer to incomplete type

The ‘full code’ is at pastebin.com – here (won’t expire). But I think that with the explanation below, anybody can understands. Note: I haven’t implemented yet the function that will erase the allocated memory and other things.

I have a struct defined in a 1.c file:

#include "1.h"
...
struct test {
   int a;
   };
...

I have a 1.h wicth have the typedef using it:

...
typedef struct test testT;
...

Then I have a function that has a parameter in it depending on testT, wich is in 2.c:

...
void funcTest(testT **t, int *size, ..){
   /* another function that creates mem.space/alocate memory based enter code here`on the need of size above */
   createMem(t,*size); /* void createMem(testT **t, int size); */

   t[0]->a = 0; /*ERROR HERE*/
   /* ... more code ... */
}
...

The 2.h file is like this:

...
void funcTest(testT **t, int *size, ..);
...

I will pass a testT *var as the way below, at the main programam:

...
testT *varTest; int size;

funcTest(&varTest, &size);
...

The bizarre thing is that the code compile when I use struct test at 1.h file (removing struct test from 1.c – which is wrong). But, when running the compiled program, exactly where the error occurs is the place of t[0]->a.

I already tried ‘everything’ but nothing worked 🙁 I have faith that is something very stupid, so if anybody knows something, please tell me 😀
Thanks!

  • 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-20T15:33:19+00:00Added an answer on May 20, 2026 at 3:33 pm

    When you try to access the a member of the t[0] struct the compiler needs to know how this struct looks like (for example to see if there even is any a member in it). Since you didn’t put the struct test type definition anywhere where the compiler can see it when compiling 2.c, you get an error. The compiler doesn’t know what a struct test contains.

    If you put the definition of the struct test in 1.h, the compiler sees how that type looks like and can use the struct members.

    Just put the complete type definition in 1.h, that’s where it’s supposed to be.

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

Sidebar

Related Questions

Hello I have the following error by git-fsck, which cannot be cleaned by git-gc
Hello everybody I'm trying to replace the 'text' input type to 'password' . And
Lets say I have some code: <?php echo Hello Everybody!; echo <br/> ; $var1
Hello again ladies and gents! OK, following on from my other question on ASP.NET
Hello I am compiling a program with make but I get the error of
Hello everybody I've recently asked this question and I've given up with the 'replace
Hello everybody! I have a SQL (see above) and i would like to know
Hello everybody let me give you the background first: I'm working on a project
How can i cut off the last empty space? a = ['Hello ','everybody ','!
My string contain a lot of HTML entities, like this &#x22;Hello&nbsp;&lt;everybody&gt;&nbsp;there&#x22; And I want

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.