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. Use a Qt library in Visual studio
QtWS25 Last Chance

Use a Qt library in Visual studio

Scheduled Pinned Locked Moved General and Desktop
10 Posts 3 Posters 4.7k Views
  • 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.
  • L Offline
    L Offline
    lmenale
    wrote on 6 Oct 2015, 07:44 last edited by
    #1

    Hi all,
    I would like to use a library created with Qt in a Microsoft project.

    This means that the object in the Qt library have to follow the windows interface.
    My scope is to use the Qt class in the Visual Studio project.

    Thanks,
    LM

    1 Reply Last reply
    0
    • J Offline
      J Offline
      JohanSolo
      wrote on 6 Oct 2015, 07:53 last edited by
      #2

      Hi and welcome,

      @lmenale said:

      Hi all,
      I would like to use a library created with Qt in a Microsoft project.

      This means that the object in the Qt library have to follow the windows interface.

      I'm not sure to understand what you mean... Qt is no compiler, therefore which compiler did you use? Is your library a shared one?

      You need to compile your library with MSVC first.
      Then simply add the path to your headers in the new project include path, add the path of the .lib file to the new project library directory and don't forget to add the .lib to the "additional dependencies".

      `They did not know it was impossible, so they did it.'
      -- Mark Twain

      1 Reply Last reply
      0
      • L Offline
        L Offline
        lmenale
        wrote on 6 Oct 2015, 07:57 last edited by lmenale 10 Jun 2015, 07:58
        #3

        Thanks for your reply.

        Maybe I ask in the wrong way.
        My problem is this.

        I have a shared lib based on Qt classes and my purpose is to use this classes in a Visual Studio project.

        1 Reply Last reply
        0
        • J Offline
          J Offline
          JohanSolo
          wrote on 6 Oct 2015, 08:06 last edited by
          #4

          Which compiler did you use? It changes a lot... If you used MSVC, then you're most probably done, if you used mingw, it can be quite a lot of work, as symbols are no exported by defaults.

          `They did not know it was impossible, so they did it.'
          -- Mark Twain

          1 Reply Last reply
          0
          • L Offline
            L Offline
            lmenale
            wrote on 6 Oct 2015, 08:18 last edited by
            #5

            I use visual studio express so MSVC.

            This means that I can use a Class in my qt shared library from a VB code?

            J J 2 Replies Last reply 6 Oct 2015, 08:37
            0
            • L lmenale
              6 Oct 2015, 08:18

              I use visual studio express so MSVC.

              This means that I can use a Class in my qt shared library from a VB code?

              J Offline
              J Offline
              JohanSolo
              wrote on 6 Oct 2015, 08:37 last edited by
              #6

              @lmenale said:

              This means that I can use a Class in my qt shared library from a VB code?

              I'm afraid I have no clue if using a C++ dll in a VB project works. My knowledge is limited to C++ as far as Visual Studio is concerned. Maybe you can use marshalling as in C#?

              `They did not know it was impossible, so they did it.'
              -- Mark Twain

              1 Reply Last reply
              0
              • L Offline
                L Offline
                lmenale
                wrote on 6 Oct 2015, 08:55 last edited by
                #7

                Ok,
                please give more info about "marshalling as in C#"

                I found this:
                http://doc.qt.io/qt-5/activeqt-server.html

                1 Reply Last reply
                0
                • J Offline
                  J Offline
                  JohanSolo
                  wrote on 6 Oct 2015, 08:56 last edited by
                  #8

                  I code as little as I can in C#, therefore I'm not the person who could answer this as best. Moreover I have no idea whether there is an equivalent functionality in VB.

                  `They did not know it was impossible, so they did it.'
                  -- Mark Twain

                  1 Reply Last reply
                  0
                  • L lmenale
                    6 Oct 2015, 08:18

                    I use visual studio express so MSVC.

                    This means that I can use a Class in my qt shared library from a VB code?

                    J Offline
                    J Offline
                    Jakob
                    wrote on 8 Oct 2015, 06:05 last edited by
                    #9

                    @lmenale

                    It seems you're asking a question that has nothing to do with Qt, honestly. It seems what you're really asking, is whether you can call into a shared library, which presumably was build using MSVC (you didn't quite answer that crucial question yet), from a VB code, which you also compile in MSVC.

                    If that is correct, it seems to me you'll need to look into some MS documentation, like this: https://msdn.microsoft.com/en-us/library/dt232c9t.aspx

                    There is nothing special about a shared library built on top of Qt, compared to any other library (except for some runtime dependencies on Qt dlls). Whatever is true for any shared (c++) library compiled using MSVC, will be true for your library as well.

                    L 1 Reply Last reply 8 Oct 2015, 11:44
                    0
                    • J Jakob
                      8 Oct 2015, 06:05

                      @lmenale

                      It seems you're asking a question that has nothing to do with Qt, honestly. It seems what you're really asking, is whether you can call into a shared library, which presumably was build using MSVC (you didn't quite answer that crucial question yet), from a VB code, which you also compile in MSVC.

                      If that is correct, it seems to me you'll need to look into some MS documentation, like this: https://msdn.microsoft.com/en-us/library/dt232c9t.aspx

                      There is nothing special about a shared library built on top of Qt, compared to any other library (except for some runtime dependencies on Qt dlls). Whatever is true for any shared (c++) library compiled using MSVC, will be true for your library as well.

                      L Offline
                      L Offline
                      lmenale
                      wrote on 8 Oct 2015, 11:44 last edited by
                      #10

                      @Jakob
                      The link that you give me it's enough for what I have to do.

                      The answer on your question is I build a qt shared library using MSVC.
                      Thanks.

                      1 Reply Last reply
                      0

                      3/10

                      6 Oct 2015, 07:57

                      topic:navigator.unread, 7
                      • Login

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