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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:28:24+00:00 2026-06-08T09:28:24+00:00

I have a problem with compiling C application, the errors that are shown are

  • 0

I have a problem with compiling C application, the errors that are shown are senseless. I don’t know where to start looking for a solution.

Here is the code:

static char* FilterCreate(
    void* arg,
    const char* const* key_array, const size_t* key_length_array,
    int num_keys,
    size_t* filter_length) {
  *filter_length = 4;
  char* result = malloc(4); // error: error C2143: syntax error : missing ';' before 'type' C:\Projects\myleveldb\db\c_test.c
  memcpy(result, "fake", 4);
  return result;
}

Here is the fullscreen screenshot:
Screenshot

What might cause such error?

  • 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-08T09:28:25+00:00Added an answer on June 8, 2026 at 9:28 am

    You are compiling C code with a C89/90 compiler.

    In classic C (C89/90) it is illegal to declare variables in the middle of a block. All variables must be declared at the beginning of a block.

    Once you started to write statements, like *filter_length = 4, it means that you are done with declarations. You are no longer allowed to introduce variable declarations in this block. Move your declaration higher and the code will compile.


    In C language declarations are not statements (as opposed to C++ where declaration is just a form of statement). And in C89/90 the grammar for compound statement is:

    compound-statement:
      { declaration-list[opt] statement-list[opt] }
    

    meaning that all declarations have to come first, at the beginning of the block.

    Note that in C99 declarations are not statements either. But the grammar for compound statement has been changed to:

    compound-statement:
      { block-item-list[opt] }
    
    block-item-list:
      block-item
      block-item-list block-item
    
    block-item:
      declaration
      statement
    

    which is why you can interleave declarations and statements in C99.

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

Sidebar

Related Questions

I have a problem with compiling an Oracle trigger via SQL*PLUS - I don't
I have problem with show or hide form in Window Form Application. I start
I have a WinForms based application. It's compiling and running perfectly. Problem is, ever
The problem is this: I have multiple competing threads (100+) that need to access
I have a problem with g++ building an application which links to a static
I have a VB.Net 1.1 application works just fine after compiling in Visual Studio.
I'm cross-compiling an application, but linking blows up with an error that it cannot
The problem: I have a web application which is served by Jetty webserver v
I have a Delphi 6 application that sends bitmaps to a DirectShow DLL in
I have an application that was developed for Linux x86 32 bits. There are

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.