Title: Trouble Compiling Wallets Post by: hipsterzipster69 on June 20, 2014, 09:33:01 PM Hello to all of the dedicated C++ programmers out there. I am really new to C++, but I decided to use a comprehensive guide to make an alternate cryptocurrency. I finished the new altcoin, but am having a lot of trouble with building the Mac OSX wallet. I always get a compile error when it gets to the macdockiconhandler.mm file. I've perused the internet for a solution, but I only see people with the same problem and no solution. The code for the file with the compile error is here:
#include "macdockiconhandler.h" #include <QtGui/QMenu> #include <QtGui/QWidget> extern void qt_mac_set_dock_menu(QMenu*); #undef slots #include <Cocoa/Cocoa.h> @interface DockIconClickEventHandler : NSObject { MacDockIconHandler* dockIconHandler; } @end @implementation DockIconClickEventHandler - (id)initWithDockIconHandler:(MacDockIconHandler *)aDockIconHandler { self = [super init]; if (self) { dockIconHandler = aDockIconHandler; [[NSAppleEventManager sharedAppleEventManager] setEventHandler:self andSelector:@selector(handleDockClickEvent:withReplyEvent:) forEventClass:kCoreEventClass andEventID:kAEReopenApplication]; } return self; } - (void)handleDockClickEvent:(NSAppleEventDescriptor*)event withReplyEvent:(NSAppleEventDescriptor*)replyEvent { Q_UNUSED(event) Q_UNUSED(replyEvent) if (dockIconHandler) dockIconHandler->handleDockIconClickEvent(); } @end MacDockIconHandler::MacDockIconHandler() : QObject() { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; this->m_dockIconClickEventHandler = [[DockIconClickEventHandler alloc] initWithDockIconHandler:this]; this->m_dummyWidget = new QWidget(); this->m_dockMenu = new QMenu(this->m_dummyWidget); qt_mac_set_dock_menu(this->m_dockMenu); [pool release]; } MacDockIconHandler::~MacDockIconHandler() { [this->m_dockIconClickEventHandler release]; delete this->m_dummyWidget; } QMenu *MacDockIconHandler::dockMenu() { return this->m_dockMenu; } void MacDockIconHandler::setIcon(const QIcon &icon) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSImage *image; if (icon.isNull()) image = [[NSImage imageNamed:@"NSApplicationIcon"] retain]; else { QSize size = icon.actualSize(QSize(128, 128)); QPixmap pixmap = icon.pixmap(size); CGImageRef cgImage = pixmap.toMacCGImageRef(); image = [[NSImage alloc] initWithCGImage:cgImage size:NSZeroSize]; CFRelease(cgImage); } [NSApp setApplicationIconImage:image]; [image release]; [pool release]; } MacDockIconHandler *MacDockIconHandler::instance() { static MacDockIconHandler *s_instance = NULL; if (!s_instance) s_instance = new MacDockIconHandler(); return s_instance; } void MacDockIconHandler::handleDockIconClickEvent() { emit this->dockIconClicked(); } After I try to make the wallet, I get these compile errors: src/qt/macdockiconhandler.mm:50:39: error: assigning to 'objc_object *' from incompatible type 'DockIconClickEventHandler *' ...= [[DockIconClickEventHandler alloc] initWithDockIconHandler:this]; ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/qt/macdockiconhandler.mm:60:6: warning: receiver type 'objc_object *' is not 'id' or interface pointer, consider casting it to 'id' [-Wreceiver-expr] [this->m_dockIconClickEventHandler release]; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If anybody could help, that would be amazing. |