Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Mixing Qt and platform-dependent development
Forum Updated to NodeBB v4.3 + New Features

Mixing Qt and platform-dependent development

Scheduled Pinned Locked Moved General and Desktop
14 Posts 2 Posters 5.3k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #4

    Nothing to configure, in your pro file just add the objective-c/c++ source files to OBJECTIVE_SOURCES rather than SOURCES

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    1 Reply Last reply
    0
    • P Offline
      P Offline
      Peppy
      wrote on last edited by
      #5

      Yes, but QtCreator somehow does not handle those files (syntax highlighting is somehow broken).

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #6

        Which version of Qt Creator are you using ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • P Offline
          P Offline
          Peppy
          wrote on last edited by
          #7

          Well 3.1.2 now. I am not sure how should correct syntax highlight look like.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #8

            Did you download the syntax highlight definition file for Objective-C/C++ ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • P Offline
              P Offline
              Peppy
              wrote on last edited by
              #9

              Yes I did, but it doesn't work correctly.

              @https://www.dropbox.com/s/atyq03rc4h3nb1n/Screenshot 2014-08-02 23.13.55.png@

              1 Reply Last reply
              0
              • P Offline
                P Offline
                Peppy
                wrote on last edited by
                #10

                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.

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #11

                  Can you show your code ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • P Offline
                    P Offline
                    Peppy
                    wrote on last edited by
                    #12

                    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.

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #13

                      It would help to have the content of NativeWindowExtensions.h

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • P Offline
                        P Offline
                        Peppy
                        wrote on last edited by
                        #14

                        Well here you go: "Pastebin.com":http://pastebin.com/nTdkLC20

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved