Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt Snap7 Using Problem
Qt 6.12 LTS is out! See what's new in the release blog

Qt Snap7 Using Problem

Scheduled Pinned Locked Moved Solved General and Desktop
22 Posts 6 Posters 7.6k 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
    #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 Online
            Christian EhrlicherC Online
            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
                                  • mrjjM Offline
                                    mrjjM Offline
                                    mrjj
                                    Lifetime Qt Champion
                                    wrote on last edited by
                                    #21

                                    Hi
                                    Qt wise. The Qt mingw packet comes with compiler and debugger.
                                    The Qt Visual studio packet is only Qt and compiler and debugger must be downloaded from microsoft.

                                    Visual studio is the standard on Windows, so often its 3rd party libraries come with project files / build instructions for visual studio
                                    and more rarely directly support mingw tool chain.

                                    That said, mingw is a fine compiler works super fine for most.

                                    1 Reply Last reply
                                    1
                                    • F Offline
                                      F Offline
                                      fire_man
                                      wrote on last edited by
                                      #22

                                      So what was the final solution@V0rtex
                                      Is it just a compiler switch?

                                      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
                                      • Unsolved