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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:06:15+00:00 2026-05-23T22:06:15+00:00

I get the expected specifier-qualifier-list error and upon searching, some people describe cyclic dependency.

  • 0

I get the expected specifier-qualifier-list error and upon searching, some people describe cyclic dependency. I’m not sure what that means and could use an explanation if possible. Basically I have a class Foo that uses a Bar type in the .m file. I don’t need an ivar of Bar. I thought that I could #import “Bar.h” in the Foo.h file since Foo.m imports the Foo.h file, but that’s where I get the error. Why do you put it in the .m file in this case, and not just include everything in the .h file to make things more clean at the top of the file? Sorry if this is a dumb question. 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-05-23T22:06:15+00:00Added an answer on May 23, 2026 at 10:06 pm

    A Cyclic Dependency is exactly what it sounds like. You definitely have one.

    Look at it like this:

    Foo needs Bar, but Bar needs Foo.

    So, you instantiate Foo, it gets a reference to Bar. Well this instantiates Bar, so this gets a reference to Foo. This instantiates Foo again, so it gets a reference to Bar. Welp, this Bar needs a Foo, so it goes and gets a reference to Foo.

    This keeps happening over and over and over, essentially a infinite loop. To get past a cyclic dependency, you tell Foo about Bar

    //Foo.h
    @class Bar
    
    @interface Foo: NSObject {
    
    }
    
    @end
    

    Then, import the header of Bar in Foo.m

    //Foo.m
    #import "Foo.h"
    #import "Bar.h"
    
    @implementation Foo
    -(void)barTime {
         Bar bar = [[[Bar alloc] init] autorelease];
         [bar getDrunk];
    }
    
    @end
    

    This breaks the chain. Foo just knows about Bar, so only Bar gets Foo.

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

Sidebar

Related Questions

I keep getting this error: expected specifier-qualifier-list before ‘tcp_seq’ in my header file. Here
I get the following compilation error: error: expected `;' before 'it' Here's my code:
i get this error when trying this: ERROR method name expected. How should i
I get the following error: ActiveRecord::AssociationTypeMismatch in ContractsController#create ExchangeRate(#2183081860) expected, got HashWithIndifferentAccess(#2159586480) Params: {commit=>Create,
I get the following error with the code below. expected constructor, destructor, or type
I installed subclipse in eclipse, but I get an error message Expected format '3'
We get the following error; The request was aborted: Could not create SSL/TLS secure
Specifically, with a SortedMap<Vector<String>, int> I get dimensions expected after this ( int )
Doing an ajax get request works as expected using the following code: $.ajax({ type:
I'm experiencing some behavior I did not expect. I have a synchronous procedure that

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.