I want to use NSRunningApplication in my Qt application on Mac OS X.
I tried to include these header files in mainwindow.cpp:
#include Cocoa/Cocoa.h
#include Foundation/Foundation.h
#include AppKit/NSRunningApplication.h
#include AppKit/NSWorkspace.h
#include ApplicationServices/ApplicationServices.h
#include "CGWindow.h".
Also included following in .pro file
INCLUDEPATH += /System/Library/Frameworks/Foundation.framework/Headers
But this gives error: stray '@' in program
/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:6:
In file included from /System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:6,
/System/Library/Frameworks/Foundation.framework/Headers/NSZone.h:8 : error: stray '@' in program.
My question is:
How to use NSRunningApplication in my application?
Which file(s) to include and where/how to remove these errors?
You need to make an objc file instead. Change the extension to .mm and use objc directive to import framework: