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

  • Home
  • SEARCH
  • 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 7027669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:16:43+00:00 2026-05-28T00:16:43+00:00

I’m writing a function that parses a file with texture and animation data and

  • 0

I’m writing a function that parses a file with texture and animation data and loads it into some global structs I have declared. I get the compiler warning “Assignment from incompatible pointer type” on a particular line. It’s a lot of code, so I’m just going to post the important parts here.

First, I have a struct datatype for my animation routines, as follows:

    typedef struct {
        unsigned int frames;
        GLuint *tex;
        float *time;
        struct animation *next;
    } animation;

As you can see, the last variable in the struct is a pointer to another animation to default to when the animation is completed.

Here is the declaration of the loading function:

    void LoadTexturePalette(GLuint **texture, animation **anim, const char *filename)

The function loads information into an array of animations, hence the double pointer.

At the very end of loading each animation, an integer is pulled from the file that indicates which animation (out of the ones that are loaded) to which the “next” pointer will point.

    fread(tmp, 1, 4, file);
    (*anim)[i].next = &((*anim)[*tmp]);

On the last line, I get the compiler warning. I’m not yet using that variable, so I don’t know if the warning is an issue, but I get the feeling that my syntax or my approach may be incorrect in setting that variable.

  • 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-28T00:16:44+00:00Added an answer on May 28, 2026 at 12:16 am
       typedef struct { /* no tag in definition */
           unsigned int frames;
           GLuint *tex;
           float *time;
           struct animation *next; /* pointer to an undefined structure */
       } animation;
    

    Without the tag (typedef struct animation { /* ... */ } animation;) any reference to “struct animation” inside the struct definition is a reference to an, as yet, undefined structure. As you only use a pointer to that undefined structure, the compiler doesn’t mind.

    So, add the tag — and maybe even get rid of the typedef: it only adds clutter 🙂

        typedef struct animation { /* tag used in definition */
            unsigned int frames;
            GLuint *tex;
            float *time;
            struct animation *next; /* pointer to another of this structure */
        } animation;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have a French site that I want to parse, but am running into
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
I want to construct a data frame in an Rcpp function, but when I
I have a reasonable size flat file database of text documents mostly saved in

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.