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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T21:26:28+00:00 2026-06-16T21:26:28+00:00

This is mostly an xcode question. I have an objective-c header with an small

  • 0

This is mostly an xcode question.
I have an objective-c header with an small protocol definition and a seperate C function declaration. I wanted to merge those few header declarations into a larger file that was previously all C code but the xcode compiler is complaining.
It seems like it should be possible since the original file which included these declarations was also a .h file. Is there a compiler flag I should flip to get my old header recognized as an objective C header?

The problem is, when I include the old header with the objective C code I get an error on the parts that are objective C (the @protocol and @end pieces specifically). I would like to get around this error without moving the objective C code out of the old header.

@protocol ConnectorDelegate

-(void)connectorDidReturnValue:(int)value;
@end

initializeConnector(id<ConnectorDelegate> delegate);

I get “Expected identifier or ‘(‘” at the @protocol and @end parts.

  • 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-16T21:26:30+00:00Added an answer on June 16, 2026 at 9:26 pm

    I could ask why you would want to do this in a C environment (perhaps you’re moving to Objective-C?), but I’ll instead center on getting rid of your errors so you can move forward.

    While you may be working in a header file, it’s still being included for a C source file. C knows nothing of protocols; they’re the province of Objective-C.

    Given that Objective-C is a superset of C, you should be able to change the extension of the file that is including this header from .c to .m with no ill effects, and it should get rid of the compiler errors.

    EDIT

    You can also frame your protocol declaration with #ifdef __objc__ and #endif; this would pre-empt having to change the extensions of your .c files.

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

Sidebar

Related Questions

This is mostly just out of curiosity, and is potentially a silly question. :)
This is mostly a data warehouse philosophy question. My project involves an Oracle forms
I think this is mostly because I'm new to PHP OOP, but I have
This question is mostly academic. I ask out of curiosity, not because this poses
I have this thing working mostly. What I don't get is, if I have
This is the situation : I mostly program C# and have written types in
I have this mostly working, but I feel like there has to be a
I'm writing Objective-C++ in Xcode for iOS. My project is mostly C++ classes and
This mostly theoretical question regarding Android and Java. I want to know which Java
This question is mostly curiosity than anything else. But I currently place all my

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.