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. many stray errors including dll file
QtWS25 Last Chance

many stray errors including dll file

Scheduled Pinned Locked Moved Unsolved General and Desktop
17 Posts 3 Posters 1.6k 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.
  • T Offline
    T Offline
    TheCipo76
    wrote on 1 Jul 2021, 15:35 last edited by
    #1

    Hi to all and thanks in advance for help
    i have to monitor an industrial robot (Kawasaki) from my Qt app
    Kawasaki send me a dll ( krnx-w32.dll) to comunicate with the robot ( using tcp/ip connection QTcpsocket) but
    when i #include the dll

    #include "krnx-w32.dll"
    

    give me about 126000 issues
    for example:
    stray '\220' in program
    stray '\3' in program
    stray '@' in program
    stray '\4' in program
    stray '\377' in program
    etc etc...

    i've searched in google and read about possible codification problem (UTF16?)
    can anyone help me to find a solution??

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 1 Jul 2021, 15:40 last edited by mrjj 7 Jan 2021, 15:44
      #2

      Hi
      You don't include a DLL like that. it will then load the binary file and freak out as it's expecting text.
      The DLL is like an exe file.

      You will add lines to the project file to tell it to link to that DLL.
      https://doc.qt.io/qt-5/third-party-libraries.html

      Also if on the windows platform. That DLL MUST be made with same compiler that you use.
      You cannot use mingw and it used using visual studio etc.

      Unless its a C interface DLL. then it might work.

      You should ask Kawasaki what compiler if it exports C++ interface to be sure.
      For visual studio compiler you might need a LIB file also.

      T 1 Reply Last reply 1 Jul 2021, 16:41
      3
      • M mrjj
        1 Jul 2021, 15:40

        Hi
        You don't include a DLL like that. it will then load the binary file and freak out as it's expecting text.
        The DLL is like an exe file.

        You will add lines to the project file to tell it to link to that DLL.
        https://doc.qt.io/qt-5/third-party-libraries.html

        Also if on the windows platform. That DLL MUST be made with same compiler that you use.
        You cannot use mingw and it used using visual studio etc.

        Unless its a C interface DLL. then it might work.

        You should ask Kawasaki what compiler if it exports C++ interface to be sure.
        For visual studio compiler you might need a LIB file also.

        T Offline
        T Offline
        TheCipo76
        wrote on 1 Jul 2021, 16:41 last edited by TheCipo76 7 Jan 2021, 16:44
        #3

        @mrjj i've already added the library with "Add Library.." menu option

        win32:CONFIG(release, debug|release): LIBS += -L$$PWD/./ -lkrnx-w32
        else:win32:CONFIG(debug, debug|release):LIBS += -L$$PWD/./ -lkrnx-w32d
        

        was added to .pro file

        isn't it correct??

        the library is specific for C++ (now i've asked which compiler was used)
        and i have both .dll and .lib files

        M 1 Reply Last reply 1 Jul 2021, 16:45
        0
        • T TheCipo76
          1 Jul 2021, 16:41

          @mrjj i've already added the library with "Add Library.." menu option

          win32:CONFIG(release, debug|release): LIBS += -L$$PWD/./ -lkrnx-w32
          else:win32:CONFIG(debug, debug|release):LIBS += -L$$PWD/./ -lkrnx-w32d
          

          was added to .pro file

          isn't it correct??

          the library is specific for C++ (now i've asked which compiler was used)
          and i have both .dll and .lib files

          M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 1 Jul 2021, 16:45 last edited by mrjj 7 Jan 2021, 16:49
          #4

          @TheCipo76
          Hi
          well it looks ok. (yes its correct syntax wise and path should be valid if you point to the file )
          Now do a clean all and run qmake and then build all
          tne look in compiler panel and see if it complains about them.

          so you have the DLL in the project folder ?

          So its a visual studio DLL, it seems ?
          and you are using visual studio for your app ?

          T 1 Reply Last reply 1 Jul 2021, 16:52
          0
          • M mrjj
            1 Jul 2021, 16:45

            @TheCipo76
            Hi
            well it looks ok. (yes its correct syntax wise and path should be valid if you point to the file )
            Now do a clean all and run qmake and then build all
            tne look in compiler panel and see if it complains about them.

            so you have the DLL in the project folder ?

            So its a visual studio DLL, it seems ?
            and you are using visual studio for your app ?

            T Offline
            T Offline
            TheCipo76
            wrote on 1 Jul 2021, 16:52 last edited by TheCipo76 7 Jan 2021, 16:59
            #5

            @mrjj yes i'have .dll file in the project folder

            if i remove:

            #include "wrnx-w32.dll"
            

            no issues was detected

            MSVC 2017

            M 1 Reply Last reply 1 Jul 2021, 16:59
            0
            • T TheCipo76
              1 Jul 2021, 16:52

              @mrjj yes i'have .dll file in the project folder

              if i remove:

              #include "wrnx-w32.dll"
              

              no issues was detected

              MSVC 2017

              M Offline
              M Offline
              mrjj
              Lifetime Qt Champion
              wrote on 1 Jul 2021, 16:59 last edited by
              #6

              @TheCipo76

              ok next step is to use any of the functions the DLL provides and see if it will run.
              If it really links to the DLL. it should work.

              Ofc you must remove
              #include "wrnx-w32.dll"
              its 1000000000% incorrect. :)

              T 1 Reply Last reply 1 Jul 2021, 17:19
              0
              • M mrjj
                1 Jul 2021, 16:59

                @TheCipo76

                ok next step is to use any of the functions the DLL provides and see if it will run.
                If it really links to the DLL. it should work.

                Ofc you must remove
                #include "wrnx-w32.dll"
                its 1000000000% incorrect. :)

                T Offline
                T Offline
                TheCipo76
                wrote on 1 Jul 2021, 17:19 last edited by TheCipo76 7 Jan 2021, 17:22
                #7

                @mrjj ok
                dll's manual say:

                Common API
                Connect to Robot Controller

                int krnx_Open(
                int cont_no,
                char *hostname )

                Parameters
                cont_no
                Controller number
                hostname
                IP address or hostname of the controller

                Returns
                cont_no : Connected controller number
                Negative value : Error code ( refer to chapter 9)

                Description
                Connect to robot controller. After you call this API, you can use other APIs.

                See also
                krnx_Close

                Something like this:

                int NC=0;
                QString HostName = "192.168.1.144"
                QbyteArray IP = HostName.toLocal8Bit().constData();
                int krnx_open(int NC, char *IP);
                

                ??
                And now??

                M 1 Reply Last reply 1 Jul 2021, 17:24
                0
                • T TheCipo76
                  1 Jul 2021, 17:19

                  @mrjj ok
                  dll's manual say:

                  Common API
                  Connect to Robot Controller

                  int krnx_Open(
                  int cont_no,
                  char *hostname )

                  Parameters
                  cont_no
                  Controller number
                  hostname
                  IP address or hostname of the controller

                  Returns
                  cont_no : Connected controller number
                  Negative value : Error code ( refer to chapter 9)

                  Description
                  Connect to robot controller. After you call this API, you can use other APIs.

                  See also
                  krnx_Close

                  Something like this:

                  int NC=0;
                  QString HostName = "192.168.1.144"
                  QbyteArray IP = HostName.toLocal8Bit().constData();
                  int krnx_open(int NC, char *IP);
                  

                  ??
                  And now??

                  M Offline
                  M Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on 1 Jul 2021, 17:24 last edited by
                  #8

                  @TheCipo76
                  Call the krnx_open and see if app runs.

                  int krnx_open(int NC, char *IP); <<< this is not calling. but i assume you know that.

                  krnx_open(NC, IP); // would be calling

                  and cont_no should be zero ? The first controller is zero ?

                  T 1 Reply Last reply 1 Jul 2021, 17:28
                  0
                  • M mrjj
                    1 Jul 2021, 17:24

                    @TheCipo76
                    Call the krnx_open and see if app runs.

                    int krnx_open(int NC, char *IP); <<< this is not calling. but i assume you know that.

                    krnx_open(NC, IP); // would be calling

                    and cont_no should be zero ? The first controller is zero ?

                    T Offline
                    T Offline
                    TheCipo76
                    wrote on 1 Jul 2021, 17:28 last edited by
                    #9

                    @mrjj Yes, sorry i've forgot this line..

                    says:
                    no viable conversion from 'QByteArray' to 'char *'

                    how can i solve??

                    Yes, first controller must be zero

                    M 1 Reply Last reply 1 Jul 2021, 17:31
                    0
                    • T TheCipo76
                      1 Jul 2021, 17:28

                      @mrjj Yes, sorry i've forgot this line..

                      says:
                      no viable conversion from 'QByteArray' to 'char *'

                      how can i solve??

                      Yes, first controller must be zero

                      M Offline
                      M Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on 1 Jul 2021, 17:31 last edited by
                      #10

                      @TheCipo76 said in many stray errors including dll file:

                      QByteArray' to 'char *

                      try
                      krnx_open(NC, IP.data() );

                      T 1 Reply Last reply 1 Jul 2021, 17:36
                      0
                      • M mrjj
                        1 Jul 2021, 17:31

                        @TheCipo76 said in many stray errors including dll file:

                        QByteArray' to 'char *

                        try
                        krnx_open(NC, IP.data() );

                        T Offline
                        T Offline
                        TheCipo76
                        wrote on 1 Jul 2021, 17:36 last edited by TheCipo76 7 Jan 2021, 17:37
                        #11

                        @mrjj OMG:

                        LNK2019: refer to external symbol "int_cdecl krnx_open(int, char ) (?krnx_open @@YAHHPAD@Z) not solved in the function "public:_thiscall MainWindow::MainWindow(class QWidget) (??0MainWindow@@QAE@PAVWidget@@@Z)

                        mainwindow.obj

                        LNK1120: 1 extern not solved

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on 1 Jul 2021, 17:41 last edited by
                          #12

                          Hi,

                          From the name of the dll I would guess that you have a 32bit version. Is it also the case of the Qt version you are using ?

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

                          T 1 Reply Last reply 1 Jul 2021, 17:42
                          0
                          • SGaistS SGaist
                            1 Jul 2021, 17:41

                            Hi,

                            From the name of the dll I would guess that you have a 32bit version. Is it also the case of the Qt version you are using ?

                            T Offline
                            T Offline
                            TheCipo76
                            wrote on 1 Jul 2021, 17:42 last edited by
                            #13

                            @SGaist Yes 32 bit

                            1 Reply Last reply
                            0
                            • SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on 1 Jul 2021, 17:43 last edited by
                              #14

                              Good, then:

                              • Which compiler are you using ?
                              • Which compiler was used for that library ?

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

                              T 2 Replies Last reply 1 Jul 2021, 17:49
                              1
                              • SGaistS SGaist
                                1 Jul 2021, 17:43

                                Good, then:

                                • Which compiler are you using ?
                                • Which compiler was used for that library ?
                                T Offline
                                T Offline
                                TheCipo76
                                wrote on 1 Jul 2021, 17:49 last edited by TheCipo76 7 Feb 2021, 11:54
                                #15

                                @SGaist Qt 5.12.5 MSVC 2017 32 bit
                                C: Microsoft Visual C++ Compiler 15.9.28307.905 (x86)
                                C++: Microsoft Visual C++ Compiler 15.9.28307.905 (x86)
                                i've asked to kawasaki which compiler was used to create the dll but they don't reply me yet

                                if i try to compile with MinGW 32 bit
                                Compiler
                                C: MinGW 7.3.0 32-bit for C
                                C++: MinGW 7.3.0 32-bit for C++

                                give me this issue:

                                undefined reference to krnx_open(int, char*)

                                1 Reply Last reply
                                0
                                • SGaistS SGaist
                                  1 Jul 2021, 17:43

                                  Good, then:

                                  • Which compiler are you using ?
                                  • Which compiler was used for that library ?
                                  T Offline
                                  T Offline
                                  TheCipo76
                                  wrote on 7 Jul 2021, 08:23 last edited by
                                  #16

                                  @SGaist Kawasaki reply:

                                  “
                                  I've taken a look into the lib file and found a "Microsoft link format", so it should be compatible with Microsoft C++ and maybe also with VS C++.
                                  I hope your customer is able to handle around with dll and lib files. To use the dll file correctly, the lib file needs to be statically linked to the project. Maybe your customer forgot about that. If the lib file is correctly linked usually the compiler should be satisfied with the function calls.
                                  If the above don't work, it is possible to guarantee the compatibility with creating a new lib file out of the dll file by a lib-maker tool of VS. I don't know if Microsoft is providing such a tool and have no experience in this, but I did this a long time ago for another project in a Borland C++ programming environment with a Borland tool.
                                  If your customer needs here there is a link that describes the use a dll file in VS (see the second half of the article):
                                  https://docs.microsoft.com/en-us/cpp/build/walkthrough-creating-and-using-a-dynamic-link-library-cpp?view=msvc-160
                                  “

                                  1 Reply Last reply
                                  0
                                  • SGaistS Offline
                                    SGaistS Offline
                                    SGaist
                                    Lifetime Qt Champion
                                    wrote on 7 Jul 2021, 19:52 last edited by
                                    #17

                                    It would be nice to know which version of VS they have used. Starting with 2017 they now have backward compatibility.

                                    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
                                    1

                                    3/17

                                    1 Jul 2021, 16:41

                                    topic:navigator.unread, 14
                                    • Login

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