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. Qt Snap7 Using Problem
Forum Updated to NodeBB v4.3 + New Features

Qt Snap7 Using Problem

Scheduled Pinned Locked Moved Solved General and Desktop
22 Posts 6 Posters 3.4k Views 4 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.
  • V Offline
    V Offline
    V0rtex
    wrote on last edited by
    #1

    C:\Users\Hasan-PC\Desktop\QtSnap7-master\snap7.cpp:38: error: undefined reference to `Cli_Create@0'

    ![alt text](40d47f5f-7396-4911-a363-c467d7e9fef7-image.png image url)

    i have this problem can you help me ?

    1 Reply Last reply
    0
    • V V0rtex

      @mrjj i did it in visual studio It has S7.NET.
      I wondered if it could be done with Qt.

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

      @V0rtex
      Hi
      This is in Qt i mean.
      You can install the visual studio compiler and a Qt that matches this compiler
      and use that in Creator 100% like you do with MinGW.
      Its just another qt install than the one for mingw.

      alt text

      V 2 Replies Last reply
      2
      • sierdzioS Offline
        sierdzioS Offline
        sierdzio
        Moderators
        wrote on last edited by
        #2

        Please show us relevant parts of the .cpp file (snap7.cpp, lines 38, 43 etc.).

        This error comes from linker and can mean several things:

        • you forgot to link a library
        • your linked library is corrupted, in wrong architecture, outdated etc.
        • general build issue - rebuild the project

        (Z(:^

        1 Reply Last reply
        3
        • V Offline
          V Offline
          V0rtex
          wrote on last edited by
          #3

          I want to communucate between qt and siemens plc.

          ![alt text](1adeb772-64ad-43f9-8470-9d6c94d72673-image.png image url)

          1 Reply Last reply
          0
          • sierdzioS Offline
            sierdzioS Offline
            sierdzio
            Moderators
            wrote on last edited by
            #4

            Best paste code... screenshots are hard to read.

            Anyway, as I said: you need to properly link the library you've got from Siemens. In qmake, this means adding INCLUDEPATH and LIBS to your .pro file. Make sure the library is compiled for the right architecture and using a compatible compiler.

            (Z(:^

            1 Reply Last reply
            4
            • V Offline
              V Offline
              V0rtex
              wrote on last edited by
              #5
              QT       += core gui network
              
              greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
              
              TARGET = QtSnap7
              TEMPLATE = app
              
              DEFINES += QT_DEPRECATED_WARNINGS
              
              
              DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    
              
              SOURCES += \
                      main.cpp \
                      mainwindow.cpp \
                  snap7.cpp \
                  plc_siemens.cpp \
                  settings.cpp
              
              HEADERS += \
                      mainwindow.h \
                  snap7.h \
                  plc_siemens.h \
                  settings.h \
                  global.h
              
              FORMS += \
                      mainwindow.ui
              
              TRANSLATIONS = translation/translation_it.ts
              
              include("lib.pri")
              
              RESOURCES += \
                  resources.qrc
              
              INCLUDEPATH += $$PWD/.
              DEPENDPATH += $$PWD/.
              

              This is my .pro file

              LIBS += -L$$PWD/lib/ -lsnap7
              
              INCLUDEPATH += $$PWD/.
              DEPENDPATH += $$PWD/.
              
              

              this is lib .pri file

              and These are the contents of the "lib" folder inside the project files

              • snap7.dll

              • snap7.lib

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

                Hi and welcome to devnet,

                Did you check that your Snap7 is of the correct architecture ? If so, which compiler was used to build it ?

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

                V 1 Reply Last reply
                2
                • SGaistS SGaist

                  Hi and welcome to devnet,

                  Did you check that your Snap7 is of the correct architecture ? If so, which compiler was used to build it ?

                  V Offline
                  V Offline
                  V0rtex
                  wrote on last edited by
                  #7

                  @SGaist MinGW 7.3.0 32 Bit

                  Christian EhrlicherC 1 Reply Last reply
                  0
                  • sierdzioS Offline
                    sierdzioS Offline
                    sierdzio
                    Moderators
                    wrote on last edited by sierdzio
                    #8

                    Make sure the paths are correct! $$PWD may point to a different location than where project is being built or where the source is.

                    You can easily print them using:

                    message($$PWD/lib)
                    

                    (Z(:^

                    1 Reply Last reply
                    1
                    • V V0rtex

                      @SGaist MinGW 7.3.0 32 Bit

                      Christian EhrlicherC Offline
                      Christian EhrlicherC Offline
                      Christian Ehrlicher
                      Lifetime Qt Champion
                      wrote on last edited by
                      #9

                      @V0rtex said in Qt Snap7 Using Problem:

                      MinGW 7.3.0 32 Bit

                      Then you won't get any further with snap7.lib I would guess. You should ask the devs for a MinGW import lib (or create them by yourself - should be doable since it's a C only lib).

                      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                      Visit the Qt Academy at https://academy.qt.io/catalog

                      1 Reply Last reply
                      2
                      • V Offline
                        V Offline
                        V0rtex
                        wrote on last edited by
                        #10

                        thank you.
                        https://github.com/abedGNU/QtSnap7 i download the file from here can you check it or try it ?

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

                          Since Snap7 is OpenSource, you should build it with the compiler you are using. That will allow you to get a version that is a bit more recent and avoid the issue you are having currently.

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

                          V 1 Reply Last reply
                          1
                          • SGaistS SGaist

                            Since Snap7 is OpenSource, you should build it with the compiler you are using. That will allow you to get a version that is a bit more recent and avoid the issue you are having currently.

                            V Offline
                            V Offline
                            V0rtex
                            wrote on last edited by
                            #12

                            @SGaist is there anyway communucate with Siemens Plc in qt library ?

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

                              If by network, then you have the Qt network classes but you will have to implement the protocol yourself.

                              I think that you should take the time to build Snap7 since it looks like it's already working as you need and maintained.

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

                              V 1 Reply Last reply
                              0
                              • SGaistS SGaist

                                If by network, then you have the Qt network classes but you will have to implement the protocol yourself.

                                I think that you should take the time to build Snap7 since it looks like it's already working as you need and maintained.

                                V Offline
                                V Offline
                                V0rtex
                                wrote on last edited by
                                #14

                                @SGaist i agree with you but i dont know how to do that.
                                i am not good when things get complicated :)

                                mrjjM 1 Reply Last reply
                                0
                                • V V0rtex

                                  @SGaist i agree with you but i dont know how to do that.
                                  i am not good when things get complicated :)

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

                                  @V0rtex
                                  Hi
                                  What about installing the visual studio compiler?
                                  And please don't just install it all
                                  as it eats many gigabytes. You only need the c++ role and SDK.
                                  You have to download it from MS.

                                  I tested with vs 2019 and it just build and ran
                                  alt text

                                  V 1 Reply Last reply
                                  1
                                  • mrjjM mrjj

                                    @V0rtex
                                    Hi
                                    What about installing the visual studio compiler?
                                    And please don't just install it all
                                    as it eats many gigabytes. You only need the c++ role and SDK.
                                    You have to download it from MS.

                                    I tested with vs 2019 and it just build and ran
                                    alt text

                                    V Offline
                                    V Offline
                                    V0rtex
                                    wrote on last edited by
                                    #16

                                    @mrjj i did it in visual studio It has S7.NET.
                                    I wondered if it could be done with Qt.

                                    mrjjM 1 Reply Last reply
                                    0
                                    • V V0rtex

                                      @mrjj i did it in visual studio It has S7.NET.
                                      I wondered if it could be done with Qt.

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

                                      @V0rtex
                                      Hi
                                      This is in Qt i mean.
                                      You can install the visual studio compiler and a Qt that matches this compiler
                                      and use that in Creator 100% like you do with MinGW.
                                      Its just another qt install than the one for mingw.

                                      alt text

                                      V 2 Replies Last reply
                                      2
                                      • mrjjM mrjj

                                        @V0rtex
                                        Hi
                                        This is in Qt i mean.
                                        You can install the visual studio compiler and a Qt that matches this compiler
                                        and use that in Creator 100% like you do with MinGW.
                                        Its just another qt install than the one for mingw.

                                        alt text

                                        V Offline
                                        V Offline
                                        V0rtex
                                        wrote on last edited by
                                        #18

                                        @mrjj thank you it worked .
                                        Happy new year.

                                        1 Reply Last reply
                                        2
                                        • mrjjM mrjj

                                          @V0rtex
                                          Hi
                                          This is in Qt i mean.
                                          You can install the visual studio compiler and a Qt that matches this compiler
                                          and use that in Creator 100% like you do with MinGW.
                                          Its just another qt install than the one for mingw.

                                          alt text

                                          V Offline
                                          V Offline
                                          V0rtex
                                          wrote on last edited by
                                          #19

                                          @mrjj last question what is the different between mingw and msvc ?

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

                                            MSVC is from Microsoft (and closed source), MinGW is a port of gcc to Windows.

                                            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
                                            3

                                            • Login

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