Thread: "no matching function for call to * '*'&" (yes, its a pointer problem...i think)

  1. #1
    Registered User
    Join Date
    Feb 2009
    Posts
    2

    "no matching function for call to * '*'&" (yes, its a pointer problem...i think)

    Well, i tried googling, searching forums, FAQS, etc and unfortunately this time my results weren't very helpful

    yea, its a noob problem and im sure it has been answered many times, sorry about that.

    The errors...
    Code:
    proj\oBSU\src\Menu.cpp||In member function `void Menu::draw()':|
    proj\oBSU\src\Menu.cpp|79|error: no matching function for call to `irr::video::IVideoDriver::draw2DImage(const irr::video::ITexture*&, irr::core::position2d<irr::s32>&, irr::core::rect<irr::s32>&, bool)'|
    include\IVideoDriver.h|485|note: candidates are: virtual void irr::video::IVideoDriver::draw2DImage(const irr::video::ITexture*, const irr::core::position2d<irr::s32>&)|
    include\IVideoDriver.h|505|note:                 virtual void irr::video::IVideoDriver::draw2DImage(const irr::video::ITexture*, const irr::core::position2d<irr::s32>&, const irr::core::rect<irr::s32>&, const irr::core::rect<irr::s32>*, irr::video::SColor, bool)|
    include\IVideoDriver.h|534|note:                 virtual void irr::video::IVideoDriver::draw2DImage(const irr::video::ITexture*, const irr::core::position2d<irr::s32>&, const irr::core::array<irr::core::rect<irr::s32>, irr::core::irrAllocator<irr::core::rect<irr::s32> > >&, const irr::core::array<irr::s32, irr::core::irrAllocator<irr::s32> >&, irr::s32, const irr::core::rect<irr::s32>*, irr::video::SColor, bool)|
    include\IVideoDriver.h|548|note:                 virtual void irr::video::IVideoDriver::draw2DImage(const irr::video::ITexture*, const irr::core::rect<irr::s32>&, const irr::core::rect<irr::s32>&, const irr::core::rect<irr::s32>*, const irr::video::SColor*, bool)|
    Class Definition -
    Code:
    class Menu {
        public:
            void show();
            void hide();
            void draw();
            bool isVisible();
    
            void select(int num);
    
            void setPosition(irr::core::position2di pos);
            irr::core::position2di getPosition();
            Menu(irr::video::ITexture* textureA, irr::video::ITexture* textureB, int items, CGameManager* myManager);
        private:
            ~Menu();
    
            void configure();
            int totalItems;
    
            irr::core::rect <s32> itemSrcPos[3];
            irr::core::position2d<irr::s32> itemDrawPos[3];
            bool state[3];
    
            //irr::core::positon2d< position;
            irr::video::ITexture* menu;
            irr::video::ITexture* menuHl;
    
            void create();
            CGameManager* pManager;
    
            bool visible;
    
    };
    Constructor -
    Code:
    Menu::Menu(irr::video::ITexture* textureA, irr::video::ITexture* textureB, int items, CGameManager* myManager) {
        pManager = myManager;
        totalItems = items;
    
        menu = textureA;
        menuHl = textureB;
    
        for(int x = 0; x < totalItems-1; x++) {
            if (x != 0 ) {
                itemSrcPos[x] = irr::core::rect<irr::s32>(0, (x-1)*85 ,  255,  x*85);
                itemDrawPos[x] = irr::core::position2d<irr::s32>(380, 380 + (x*50));
            }
            else {
                itemSrcPos[x] = irr::core::rect<irr::s32>( 0, 0, 255, 85 );
                itemDrawPos[x] = irr::core::position2d<irr::s32>( 380, 380);
            }
        }
    }
    Draw() function -
    Code:
    void Menu::draw() {
        if(visible) {
            for(int x = 0; x < totalItems-1; x++) {
                // If selected...
                if(state[x] == true) {
                    pManager->getDriver()->draw2DImage(menuHl,
                        itemDrawPos[x],
                        itemSrcPos[x],
                        true
                    );
                }
                else {
                    pManager->getDriver()->draw2DImage(menu,
                        itemDrawPos[x],
                        itemSrcPos[x],
                        true
                    );
                }
            }
        }
    }
    I thought i finally got the hang of pointers but it looks like im still making a mistake somewhere, probably a missing & or something :-\

    If you want to flame me/rant about peoples inability to use google and/or the "search button" then feel free, but post a link when your done

    If you need any other info, just post. Thanks in advance for the help

    Edit: sorry just noticed that the draw2Dimage function takes an SColor as an argument as well, unfortunately that doesnt fix my problem.
    Last edited by hellshady; 02-27-2009 at 12:32 PM.

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    You give four arguments to a six argument function. You found one to get up to five; you're still missing one.

  3. #3
    Registered User
    Join Date
    Feb 2009
    Posts
    2
    Thanks, i feel pretty stupid. it looks like i got distracted and just stopped typing :-\

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. What is a virtual function pointer?
    By ting in forum C++ Programming
    Replies: 4
    Last Post: 03-05-2008, 02:36 AM
  2. Pointer in Function problem
    By lilhawk2892 in forum C++ Programming
    Replies: 7
    Last Post: 12-08-2007, 02:41 AM
  3. <Gulp>
    By kryptkat in forum Windows Programming
    Replies: 7
    Last Post: 01-14-2006, 01:03 PM
  4. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 10:18 AM
  5. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM