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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:06:09+00:00 2026-05-17T23:06:09+00:00

I have been having some trouble lately with using custom classes as types. As

  • 0

I have been having some trouble lately with using custom classes as types. As described in the title, I have been getting compile errors similar to the one below:

expected specifier-qualifier list before 'MyClass'

My code is usually something along the lines of this:

@interface MyCoolClass : NSObject {
    MyClass *myClassObject; // Error is on this line.
}

I also occasionally use something like this:

@interface MyCoolClass : NSObject {
    IBOutlet MyClass *myClassObject; // Error again on this line
}

Im not really sure if that is good to use but on occasion, I have done something like that so I could connect my objects together with Interface Builder so that one object could invoke a method on another object.

I’ve been able to do this before successfully with other projects but when I tried to do it today, it gave me this error. Any ideas what could be causing it? As far as I can tell, I have done the same thing that I did in the other project here.

It is also to my understanding that this error usually gets thrown if the type is not defined, but I am pretty sure that I have defined it.

  • 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-17T23:06:09+00:00Added an answer on May 17, 2026 at 11:06 pm

    Oh, GCC how obtuse and opaque can your errors possibly be….

    Try compiling with the LLVM 2.0 compiler. It’ll give you much more sane errors.

    In this case, what is usually going on is that the compiler doesn’t have a clue what MyClass is or there is a syntax error in the previously included header file that doesn’t cause a compilation error until the @interface is hit in the file spewing the error.

    It could also be a misspelling.


    Or, as suggested, you need to #import “MyClass.h” into the header file (or implementation file or, even better, the PCH file) so that MyClass is defined before the iVar declaration.

    @class MyClass;
    

    That’ll also do the trick.

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

Sidebar

Related Questions

I'm having some trouble extending Classes in PHP. Have been Googling for a while.
I have been having some issues with LINQ-To-SQL around memory usage. I'm using it
I having trouble in dividing the HTML frames. I have been using the following
I have been using the ASP.NET AJAX UpdatePanel control a lot lately for some
I have been having some trouble figuring out how exactly I get a process's
I have been having some trouble finding a good way to output just the
I have been having some problems trying to get my PHP running. When I
Been having some trouble implementing a single-column index in LaTeX. I've been employing the
This is a really weird problem that I have been having. When I download
I have to compute at libraries quite often these days, and have been having

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.