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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:58:10+00:00 2026-05-31T06:58:10+00:00

Okay, straight to the point, here is the code: struct TileStruct { SDL_Rect clip[0];

  • 0

Okay, straight to the point, here is the code:

    struct TileStruct
    {
        SDL_Rect clip[0];
    };
    TileStruct Tiles[] =
    {
        {
            clip[0].x = 0*TILE,
            clip[0].y = 0*TILE,
            clip[0].w = TILE,
            clip[0].h = TILE
        },
        {
            clip[0].x = 1*TILE,
            clip[0].y = 0*TILE,
            clip[0].w = TILE,
            clip[0].h = TILE
        },
        {
            clip[0].x = 0*TILE,
            clip[0].y = 1*TILE,
            clip[0].w = TILE,
            clip[0].h = TILE
        },
        {
            clip[0].x = 1*TILE,
            clip[0].y = 1*TILE,
            clip[0].w = TILE,
            clip[0].h = TILE
        }
    };

Error

too many intitializers for 'Load::Vars()::TileStruct'

Btw, TILE is the number 16.

Anyway, I’m not sure how to fix this. I’ve looked it up in several places but can’t seem to find an answer. Can someone explain what’s going wrong here? No downvoting please. I legitimately couldn’t find a solution on the net.

  • 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-31T06:58:11+00:00Added an answer on May 31, 2026 at 6:58 am

    You have declared an array of 0 elements, so you can’t initialize it with anything.
    Beside zero-sized arrays are GNU C extension – if it’s really what you need, and if that structure must be placed on stack/global place – you have to manually create memory pad with enough size:

    unsigned char tiles_memory_pad[sizeof(SDL_Rect) * NUM_TILES];
    struct TileStruct *tiles = (struct TileStruct*)tiles_memory_pad;
    

    Or use dynamic memory allocator in the same whay (again, if it’s whar you need).
    Btw, while zero-sized arrays are GNU specific, unsized arrays are standard to C99 and later (declared as int some_array[]; within structure).

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

Sidebar

Related Questions

Okay, so here's the context. I've been up for almost a day straight now
Okay, so this is a straight math question and I read up on meta
Okay, here's the scenario. I have a utility that processes tons of records, and
Okay, I'll try to make this as straight forward as possible. I'm using VB.Net
Okay, I'll be straight with you guys: I'm not sure exactly how Domain Driven
Okay here is my url: http://example.com/home/process_login I would like to replace the underscore with
Okay so here is my database: I have a page on my .net form
Okay I have seen some very similar questions here but none seem to be
EDIT: Okay, I've stripped this down to the bare minimum. The below code is
Okay, what have I done wrong here? I'm trying to .POST data from a

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.