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. csharp with qt
QtWS25 Last Chance

csharp with qt

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 4 Posters 2.4k 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.
  • R Offline
    R Offline
    Rameshguru
    wrote on last edited by
    #1

    *how to use csharp .dll in qt

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      Hi
      You mean to call a function in it ?
      or how to use ?

      It is not possible to use classes exported from it in any easy way.
      As far as i know, you must export com objects and use those in c++.

      Maybe visual studio offer some help in this area.

      You can google "csharp dll in qt" and read all the suggestions.

      1 Reply Last reply
      0
      • VRoninV Offline
        VRoninV Offline
        VRonin
        wrote on last edited by VRonin
        #3

        You need to compile with clr set on.

        In visual studio 2013:

        • project properties->configuration properties->general-> common language support -> /clr
        • project properties->configuration properties->C/C++->Code generation-> Enable C++ Exceptions->/EHa
        • project properties->configuration properties->C/C++->Code generation-> Runtime Library->/MD (or /MDd in debug)
          • The 3 options above can be applied even to a single .cpp file instead of the whole project, just right click on the file instead of the project
        • project properties->common properties->add new reference->drowse->browse->select the C# dll
        • use #using <MyCSharpLibrary.dll> at the top of your .cpp file
        • To write managed code you need a dialect of C++ called C++/CLI

        "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
        ~Napoleon Bonaparte

        On a crusade to banish setIndexWidget() from the holy land of Qt

        1 Reply Last reply
        3
        • R Offline
          R Offline
          Rameshguru
          wrote on last edited by
          #4

          @VRonin sir,
          Thank you sir,successfully added .dll file in QT but i create visual c++ project(MFC application),here display error like LNK2020 and LNK2001

          jsulmJ 1 Reply Last reply
          0
          • R Offline
            R Offline
            Rameshguru
            wrote on last edited by
            #5

            sir ,here i have add .cs( c sharp) file or .cpp (visualc++) file.
            suppose i add .cpp file means errors are(afxmn...)

            1 Reply Last reply
            0
            • R Rameshguru

              @VRonin sir,
              Thank you sir,successfully added .dll file in QT but i create visual c++ project(MFC application),here display error like LNK2020 and LNK2001

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Rameshguru said in csharp with qt:

              LNK2020 and LNK2001

              Please show the whole error messages not just these numbers.
              What does this mean: "suppose i add .cpp file means errors are(afxmn...)"?

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • R Offline
                R Offline
                Rameshguru
                wrote on last edited by
                #7

                @jsulm sir,
                first i create visuall c++ mfc application project then add library files.
                here .cpp files there (or) .cs files are there,first i go to proerties->add exising item which file are add .cpp or .cs file
                please explain clearly jsulm sir

                jsulmJ 1 Reply Last reply
                0
                • R Rameshguru

                  @jsulm sir,
                  first i create visuall c++ mfc application project then add library files.
                  here .cpp files there (or) .cs files are there,first i go to proerties->add exising item which file are add .cpp or .cs file
                  please explain clearly jsulm sir

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @Rameshguru What should I explain clearly? You should explain clearly the problem. For that I asked you to post the whole error messages instead of the numbers LNK2020 and LNK2001. Can you please do so?
                  And what do you want to add actually? Source code files or a library? For library @VRonin already explained how to do it.

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  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