Mixing Qt and platform-dependent development
-
Hello guys, I wonder how can develop with Qt and Objective-C in QtCreator? I'd like to use the full "power" of the platform...
-
Hi,
Just have a look at the qtmacextras code/examples to see how to mix both
Hope it helps
-
Okay, is there any way I can configure QtCreator to work with Objective-C code?
Somehow my syntax-highlighter of Objective-C code seems to be broken. (http://goo.gl/oybesZ ) -
Nothing to configure, in your pro file just add the objective-c/c++ source files to OBJECTIVE_SOURCES rather than SOURCES
-
Yes, but QtCreator somehow does not handle those files (syntax highlighting is somehow broken).
-
Which version of Qt Creator are you using ?
-
Well 3.1.2 now. I am not sure how should correct syntax highlight look like.
-
Did you download the syntax highlight definition file for Objective-C/C++ ?
-
Yes I did, but it doesn't work correctly.
@https://www.dropbox.com/s/atyq03rc4h3nb1n/Screenshot 2014-08-02 23.13.55.png@
-
Well, I have figured out how to compile Objective-C/C++ code within QtCreator but I am not able to somehow connect C++ and Objective-C code. I'm getting weird errors like:
@.../System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:422: error: unknown type name 'NSString'; did you mean 'QString'?
FOUNDATION_EXPORT void NSLog(NSString *format, ...) NS_FORMAT_FUNCTION(1,2);
@I'm really not sure how to bind these two guys together.
-
Can you show your code ?
-
Well, okay:
I have in MainWindow.cpp something like this:@
#include "NativeWindowExtensions.h"struct NativeWindowExtensions;
class MainWindow : public QMainWindow {
NativeWindowExtensions * native;
};
@NativeWindowExtensions.h contains C++ struct which stores Objective-C object (NSWindow):
@
#import <Cocoa/Cocoa.h>//objective-C code
// c++ code
@which doesn't work.
-
It would help to have the content of NativeWindowExtensions.h
-
Well here you go: "Pastebin.com":http://pastebin.com/nTdkLC20