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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:04:39+00:00 2026-05-25T21:04:39+00:00

This problem may be as a direct result of either me misunderstanding the limitations

  • 0

This problem may be as a direct result of either me misunderstanding the limitations of Objective-C(++) and how it interacts with C++. Or it may be a case of me missing something thats right in front of me.

I have a C++ class that does some Objective-C++ work behind the scenes. As such I have a templated C++ class that makes a call to a templated function. I have then specialised the templated function to create me a UIImage.

However when I build I get the following error.

../ImageProcessing/ImageProcessing/MacOS/MacOSImage.h:43: error: no matching function for call to 'MacOSImage<R5G5B5A1>::MakeUIImage(std::vector<R5G5B5A1, std::allocator<R5G5B5A1> >&, unsigned int, unsigned int)'
../ImageProcessing/ImageProcessing/MacOS/MacOSImage.h:41: note: candidates are: UIImage* MacOSImage<ColourSpace>::MakeUIImage() [with ColourSpace = R5G5B5A1]

My header file looks like this:

#ifndef ImageProcessing_MacOSImage_h
#define ImageProcessing_MacOSImage_h

#include "Image.h"

#ifdef __OBJC__
    #import <UIKit/UIImage.h>
#else
    typedef void UIImage;
#endif

template< typename ColourSpace > UIImage* MakeUIImage( const std::vector< ColourSpace >& colours, unsigned int width, unsigned int height )
{
    return NULL;
}

template< typename ColourSpace > class MacOSImage : public BaseImage< ColourSpace >
{
protected:

public:
    MacOSImage( unsigned int width, unsigned int height );
    virtual ~MacOSImage()   {};

    UIImage* MakeUIImage();
};

template< typename ColourSpace > inline MacOSImage< ColourSpace >::MacOSImage( unsigned int width, unsigned int height ) :
    BaseImage< ColourSpace >( width, height )
{
}

template< typename ColourSpace > inline UIImage* MacOSImage< ColourSpace >::MakeUIImage()
{
    return MakeUIImage( BaseImage< ColourSpace >::Pixels(), BaseImage< ColourSpace >::GetWidth(), BaseImage< ColourSpace >::GetHeight() );
}

#endif

I find this error rather confusing. Not least of all because if you ignore my specialisations there is a template function that ought to exactly match the prototype it is after at the top of the file. Its only disadvantage is that it will return NULL. However this would still give me an idea as to what is going on if I could get it to compile.

So has anyone got any ideas why this won’t compile?

Cheers!

Edit: As requested here is Image.h:

#ifndef ImageProcessing_Image_h
#define ImageProcessing_Image_h

#include <vector>

template< typename ColourSpace > class BaseImage
{
protected:
    unsigned int                mWidth;
    unsigned int                mHeight;
    std::vector< ColourSpace >  mPixels;
public:
    BaseImage( unsigned int width, unsigned int height );
    virtual ~BaseImage()        {};

    std::vector< ColourSpace >& Pixels();
    const std::vector< ColourSpace >& Pixels() const;

    unsigned int GetWidth() const               { return mWidth;    }
    unsigned int GetHeight() const              { return mHeight;   }
    unsigned int GetBytesPerPixel() const       { return sizeof( ColourSpace );     }
    unsigned int GetBitsPerPixel() const        { return GetBytesPerPixel() * 8;    }
};

template< typename ColourSpace > inline BaseImage< ColourSpace >::BaseImage( unsigned int width, unsigned int height )  :
    mWidth( width ),
    mHeight( height ),
    mPixels( width * height )
{

}

template< typename ColourSpace > inline std::vector< ColourSpace >& BaseImage< ColourSpace >::Pixels()
{
    return mPixels;
}

template< typename ColourSpace > inline const std::vector< ColourSpace >& BaseImage< ColourSpace >::Pixels() const
{
    return mPixels;
}

#if     defined( _OSX )

#include "MacOS/MacOSImage.h"
#define Image MacOSImage

#elif   defined( _WIN32 )

#include "Win32/Win32Image.h"
typedef Win32Image Image;

#else

#error We need a platform specific implementation of the image class

#endif

#endif
  • 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-25T21:04:40+00:00Added an answer on May 25, 2026 at 9:04 pm

    This is classical name lookup problem. The compiler stops looking for names when it finds a function with the same name, ignoring the signature. Only then it checks the signature and finds it does not match.

    You want to call the free version, so you need to say:

    return ::MakeUIImage( BaseImage< ColourSpace >::Pixels(), 
    BaseImage< ColourSpace >::GetWidth(), BaseImage< ColourSpace >::GetHeight() );
    

    Unrelated hint: Better put all your stuff into your own namespace, otherwise you might sooner or later run into related difficulties when everythign is in the global namespace

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

Sidebar

Related Questions

I may just be missing something obvious here, so I apologize if this is
This problem may seem like school work, but it isn't. At best it is
I may be approaching this problem from the wrong angle but what I'm thinking
This may be a very simple problem, but I couldn't find an answer googleing
Some of you may recognize this as Project Euler's problem number 11. The one
I am new to flash, so the solution to this problem may be simple.
This problem crops up every now and then at work. Our build machine can
This problem occurred during daylight saving time change. After the change occurred, we've noticed
This problem has been solved thanks to your suggestions. See the bottom for details.
This problem has been kicking my butt for a few days now. I have

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.