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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:48:00+00:00 2026-06-12T08:48:00+00:00

Hi I am compiling ffmpeg using xcode, which I believe uses clang for compilation.

  • 0

Hi I am compiling ffmpeg using xcode, which I believe uses clang for compilation. In ffmpeg there is a struct with a member variable named ‘class’ I believe this is perfectly fine in C but clang is trying to parse it as a keyword. Any idea how to fix? Basically the following in a cpp file will cause the error:

extern C {
    typedef struct {
        int class;
    } SomeStruct;
}

It tries to interpret class as a keyword.

FYI the file that is throwing the error in ffmpeg is libavcodec/mpegvideo.h and I need to include this to have access to the MpegEncContext struct to pull out motion map info.

EDIT

The above code sample was just to demonstrate the error. But perhaps its fixable in another way. In my actual code I have it like this:

#ifdef __cplusplus
extern "C" {
#endif

    #include "libavcodec/mpegvideo.h"
    #include "libavformat/avformat.h"

#if __cplusplus
} //Extern C
#endif

How would I get that to include the two files as C files and not C++?

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-06-12T08:48:01+00:00Added an answer on June 12, 2026 at 8:48 am

    It’s completely fine in C. When you build that as C++, you encounter an error because class is a C++ keyword.

    As far as fixing it, you would normally choose an identifier other than class. However, ffmpeg developers may not be so agreeable with that change. Therefore, you may need to either:

    • restrict the visibility of that header to C translations
    • or edit your own copy in order to use it in C++ translations

    Fortunately, you are also using a C compiler which has good support of C99 features in this case. C Compilers which do not support C99 well are particularly troublesome with ffmpeg sources (because you would then compile the whole program as C++ for the C99 features, and the conflict count would be much higher).

    (there are other dirty tricks you could do to try to work around the problem, but i will not mention them)

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

Sidebar

Related Questions

Compiling this code using g++ 4.2.1: struct S { }; template<typename T> struct ST
I used to calculate the duration of MP3 files server-side using ffmpeg - which
Compiling in XCode 3.1.3 using GCC 4, under Leopard 10.5.8, with 10.5 as my
When compiling an older project in Xcode 4.5, there is a warning: '__bridge' casts
I am compiling ffmpeg on Snow Leopard from source. Using Macport is not an
In compiling qt I found that there is a qws target called arm-linux-gcc. I
When compiling a c file that uses old style function definition like int foo(a)
When compiling : #include <vector> template<class T> class foo { void bar() { std::vector<T>
Is there any free, small, fast, thing for compiling C# .net 3.5 console apps
When compiling (Microsoft Visual C++ 2005 Express) this piece of code: struct 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.