Mac OS X linker error in Qt; CoreGraphics & CGWindowListCreate

Posted by Jake Petroules on Stack Overflow See other posts from Stack Overflow or by Jake Petroules
Published on 2010-05-27T08:43:13Z Indexed on 2010/05/27 10:41 UTC
Read the original article Hit count: 372

Filed under:
|
|
|
|

Here is my .mm file

#include "windowmanagerutils.h"

#ifdef Q_OS_MAC
#import </System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreGraphics.framework/Headers/CGWindow.h>

QRect WindowManagerUtils::getWindowRect(WId windowId)
{
    CFArrayRef windows = CGWindowListCreate(kCGWindowListOptionOnScreenOnly, kCGNullWindowID);
    return QRect();
}

QRect WindowManagerUtils::getClientRect(WId windowId)
{
    return QRect();
}

QString WindowManagerUtils::getWindowText(WId windowId)
{
    return QString();
}

WId WindowManagerUtils::rootWindow()
{
    QApplication::desktop()->winId();
}

WId WindowManagerUtils::windowFromPoint(const QPoint &p, WId parent, bool(*filterFunction)(WId))
{
    return NULL;
}

void WindowManagerUtils::setTopMostCarbon(const QWidget *const window, bool topMost)
{
    if (!window)
    {
        return;
    }

    // Find a Cocoa equivalent for this Carbon function
    // [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
    // OSStatus ret = HIViewSetZOrder(this->winId(), kHIViewZOrderAbove, NULL);
}
#endif

The linker is telling me "_CGWindowListCreate" is undefined. What libraries must I link to? Apple's documentation is not very helpful on telling what to include or link to, like MSDN is. Also I couldn't just do #import <CGWindow.h>, I had to specify the absolute path to it... any way around that?

© Stack Overflow or respective owner

Related posts about c++

Related posts about objective-c