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

many stray errors including dll file

Scheduled Pinned Locked Moved Unsolved General and Desktop
17 Posts 3 Posters 1.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.
  • TheCipo76T Offline
    TheCipo76T Offline
    TheCipo76
    wrote on 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
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #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.

      TheCipo76T 1 Reply Last reply
      3
      • mrjjM mrjj

        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.

        TheCipo76T Offline
        TheCipo76T Offline
        TheCipo76
        wrote on last edited by TheCipo76
        #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

        mrjjM 1 Reply Last reply
        0
        • TheCipo76T TheCipo76

          @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

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by mrjj
          #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 ?

          TheCipo76T 1 Reply Last reply
          0
          • mrjjM mrjj

            @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 ?

            TheCipo76T Offline
            TheCipo76T Offline
            TheCipo76
            wrote on last edited by TheCipo76
            #5

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

            if i remove:

            #include "wrnx-w32.dll"
            

            no issues was detected

            MSVC 2017

            mrjjM 1 Reply Last reply
            0
            • TheCipo76T TheCipo76

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

              if i remove:

              #include "wrnx-w32.dll"
              

              no issues was detected

              MSVC 2017

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on 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. :)

              TheCipo76T 1 Reply Last reply
              0
              • mrjjM mrjj

                @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. :)

                TheCipo76T Offline
                TheCipo76T Offline
                TheCipo76
                wrote on last edited by TheCipo76
                #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??

                mrjjM 1 Reply Last reply
                0
                • TheCipo76T TheCipo76

                  @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??

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on 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 ?

                  TheCipo76T 1 Reply Last reply
                  0
                  • mrjjM mrjj

                    @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 ?

                    TheCipo76T Offline
                    TheCipo76T Offline
                    TheCipo76
                    wrote on 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

                    mrjjM 1 Reply Last reply
                    0
                    • TheCipo76T TheCipo76

                      @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

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @TheCipo76 said in many stray errors including dll file:

                      QByteArray' to 'char *

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

                      TheCipo76T 1 Reply Last reply
                      0
                      • mrjjM mrjj

                        @TheCipo76 said in many stray errors including dll file:

                        QByteArray' to 'char *

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

                        TheCipo76T Offline
                        TheCipo76T Offline
                        TheCipo76
                        wrote on last edited by TheCipo76
                        #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 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

                          TheCipo76T 1 Reply Last reply
                          0
                          • SGaistS SGaist

                            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 ?

                            TheCipo76T Offline
                            TheCipo76T Offline
                            TheCipo76
                            wrote on last edited by
                            #13

                            @SGaist Yes 32 bit

                            1 Reply Last reply
                            0
                            • SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on 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

                              TheCipo76T 2 Replies Last reply
                              1
                              • SGaistS SGaist

                                Good, then:

                                • Which compiler are you using ?
                                • Which compiler was used for that library ?
                                TheCipo76T Offline
                                TheCipo76T Offline
                                TheCipo76
                                wrote on last edited by TheCipo76
                                #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

                                  Good, then:

                                  • Which compiler are you using ?
                                  • Which compiler was used for that library ?
                                  TheCipo76T Offline
                                  TheCipo76T Offline
                                  TheCipo76
                                  wrote on 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 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

                                    • Login

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