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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T20:10:23+00:00 2026-05-18T20:10:23+00:00

Hey, I am making some stuff in Objective-C++… And I must say that I

  • 0

Hey, I am making some stuff in Objective-C++… And I must say that I am a total newbie when it comes to the Objective-C part… I don’t really want to learn it, I kinda just need it for accessing a few Mac APIs (ObjC is such a dumb language).

So – compiling with g++ -x objective-c++ – and I somehow keep getting this warning:

XXX may not respond to YYY

First it was with a NSScreen, now it is with a NSWindow:

NSWindow may not respond to +initWithContentRect:styleMask:backing:defer:

I saw somewhere that I should cast it to id, but didn’t work, throwing absolutely cryptic errors…

So – WHAT does this warning actually mean and HOW am I supposed to make it stop?

EDIT: Okay, apparently I need to ALLOCATE an instance first, then I can call its init function… Anyways, now the GCC is reporting:

confused by earlier errors, bailing out

And NOTHING else. This is the ONLY error that it reports. I figured that there is some error in my code that doesn’t get reported… So I will post the whole file where the problem is here:

ONXeWindow::ONXeWindow(int px, int py, int sw, int sh, bool resizable){
    NSRect wr = NSMakeRect(px, py, sw, sh);

    int wf = 1; // titled
    wf += 2; // closable
    wf += 4; // miniaturizable
    wf += (resizable ? 8 : 0); // resizable
    wf += (false ? 128 : 0); // metal bg

    useWindow = [[NSWindow alloc] initWithContentRect:wr styleMask:wf backing:2 defer:YES];
}

Also, YES, framework AppKit was imported (in the header file) – I am not going to confuse you with my weird file scheme here.

  • 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-18T20:10:24+00:00Added an answer on May 18, 2026 at 8:10 pm

    The message isn’t really cryptic, you just don’t know the language (and don’t care to, by your own admission).

    Since Objective-C methods are dispatched dynamically at run-time, you can call a method that the compiler doesn’t have any knowledge of, however, the compiler is warning you that you’re doing so. The + in the beginning of the method name means that you’re calling a class method (a – would indicate that you’re calling a method on an instance). Since NSWindow has no class method named initWithContentRect:styleMask:backing:defer:, the compiler is giving you a warning, and in this case, it’s a pretty good one.

    You probably wrote something like:

    NSWindow* myWindow = [NSWindow initWithContentRect:rect styleMask:0 backing:0 defer:NO];
    

    when you meant to write something like:

    NSWindow* myWindow = [[NSWindow alloc] initWithContentRect:rect styleMask:0 backing:0 defer:NO];
    

    The first one sends the message directly to the class, but this is an instance method. You need to allocate an instance of NSWindow first, then send the init message. Also, clang tends to give much better warning and error messages than gcc. Clang 2.0 also handles C++ and ObjC++ pretty well, so it might be worth it to switch to clang.

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

Sidebar

Related Questions

Hey, I am making some stuff in Objective-C++... And I must say that I
Hey guys i'm making a website but for some reason my div tags are
Hey, I've just started learning JavaScript and I'm making a little script that generates
Currently I am making some decisions for my first objective-c API. Nothing big, just
I'm making a PHP class that handles some traffic with the use of CURL
Hey so i'm making a function that gathers up sprites that you wanna keep
Hey i am making a app in which i want to make emulator that
Hey guys, I am making an application using C# in Visual Studio that minifies
hey, am making a program that makes the forms and controls dynamically from xml
Hey, so I'm making an iPhone app and in there is a common function

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.