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. snap7 and Qt Creator
Forum Update on Monday, May 27th 2025

snap7 and Qt Creator

Scheduled Pinned Locked Moved Solved General and Desktop
12 Posts 5 Posters 1.3k 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.
  • M Offline
    M Offline
    markolino_it
    wrote on last edited by
    #1

    Hi to all.
    I'm new to Qt creator and i've need to use snap7 library (i use it already with c# in visual studio) but i have some problems.
    I've found variuos topic about this in the forum, but i see a lot of confusion so i decide to open a new thread.

    This is my problem.
    I've Qt Creator 4.10.0 based on Qt 5.13.1 in my windows 7 64bit.
    From Qt->Tools-Option->Kits i found the path of the compiler MINGW32 for my cpp project and the path is C:\Qt\Qt5.13.1\Tools\mingw730_32\bin\g++.exe and the version is 7.3.0

    So i follow the procedure found here: link text
    MinGW 32bit 4.7.2
    It is assumed that MinGW compiler is installed in C:\MinGW32 and its release is 4.7.2.
    If not, you need to modify make.bat and makefile.

    o In make.bat change the path instruction in the first line to point to the correct compiler path.
    o In makefile change the vars MINGW and MINREL (path and release).
    Pay attention to not leave trailing spaces after the text.

    So my make file is:
    path=C:\Qt\Qt5.13.1\Tools\mingw730_32\bin;%PATH
    mingw32-make %1

    and make file is:
    MINGW =C:\Qt\Qt5.13.1\Tools\mingw730_32\bin
    MINREL =7.0.3

    but when i launche make.bat from the prompt i receive this error:
    alt text

    What can i do ?
    Thanks a lot,
    Mark

    1 Reply Last reply
    0
    • M Offline
      M Offline
      markolino_it
      wrote on last edited by
      #2

      Update:
      with MinGW 32bit 4.7.2 if i follow the procedure i get my .lib and .dll file
      So now how i can use them in my Qt Creator project ?

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

        Hi and welcome to devnet,

        Using Qt Creator you can do it following the documentation here.

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

        M 1 Reply Last reply
        1
        • SGaistS SGaist

          Hi and welcome to devnet,

          Using Qt Creator you can do it following the documentation here.

          M Offline
          M Offline
          markolino_it
          wrote on last edited by markolino_it
          #4

          @SGaist
          Thanks a lot.
          But it dosnt show how to use the library in the code.
          It show how to add the library.
          What’s the next step ?

          Mark

          1 Reply Last reply
          0
          • Christian EhrlicherC Online
            Christian EhrlicherC Online
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @markolino_it said in snap7 and Qt Creator:

            But it dosnt show how to use the library in the code.

            It's pure c/c++ so what should be explained here?

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

            M 1 Reply Last reply
            1
            • Christian EhrlicherC Christian Ehrlicher

              @markolino_it said in snap7 and Qt Creator:

              But it dosnt show how to use the library in the code.

              It's pure c/c++ so what should be explained here?

              M Offline
              M Offline
              markolino_it
              wrote on last edited by
              #6

              @Christian-Ehrlicher
              I am not an user of c/c++.
              I have experience with vs and c# where i can add the reference of dll and include it in myClass by a using statement.

              Can you explain me how to do the same thing ?
              I have only .lib and .dll file nothing about .h and .cpp

              Thanks a lot

              1 Reply Last reply
              0
              • Christian EhrlicherC Online
                Christian EhrlicherC Online
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @markolino_it said in snap7 and Qt Creator:

                Can you explain me how to do the same thing ?

                When you want to use a function/class from somewhere you have to include the appropriate header to make the function available for the compiler - you should have done this earlier - otherwise I don't see how you should have compiled a single c++ source file before.

                I have only .lib and .dll file nothing about .h and .cpp

                There must be a header file for this library, otherwise you won't be able to use it.

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

                M 1 Reply Last reply
                2
                • Christian EhrlicherC Christian Ehrlicher

                  @markolino_it said in snap7 and Qt Creator:

                  Can you explain me how to do the same thing ?

                  When you want to use a function/class from somewhere you have to include the appropriate header to make the function available for the compiler - you should have done this earlier - otherwise I don't see how you should have compiled a single c++ source file before.

                  I have only .lib and .dll file nothing about .h and .cpp

                  There must be a header file for this library, otherwise you won't be able to use it.

                  M Offline
                  M Offline
                  markolino_it
                  wrote on last edited by
                  #8

                  @Christian-Ehrlicher
                  Thanks a lot Christian.
                  I will check it and i let you know asap!

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    markolino_it
                    wrote on last edited by markolino_it
                    #9

                    Ok it works.
                    So this are the steps to get it works fine:
                    1-Compile the library with file .bat to obtain .lib and .dll file.
                    Follow the instruction on snap7 site, section "rebuild".
                    2-Copy this 2 file in your folder, where found the exe file of the application
                    3-Copy the snap7.h and the snap7.cpp file of the library (can you found them in the example folder) in the same folder of your .pro file
                    3-Add an include snap7.h in your widget.h file and declare a TS7Client object.
                    4-Add in your .pro file LIBS +="path\to\your\file.dll" and run qmake

                    Remember that if you write or read some data you must swap the byte of the word/longword before you send the request.

                    I hope this help all the people comes to this post !
                    That's it :)

                    Pablo J. RoginaP M 2 Replies Last reply
                    1
                    • M markolino_it

                      Ok it works.
                      So this are the steps to get it works fine:
                      1-Compile the library with file .bat to obtain .lib and .dll file.
                      Follow the instruction on snap7 site, section "rebuild".
                      2-Copy this 2 file in your folder, where found the exe file of the application
                      3-Copy the snap7.h and the snap7.cpp file of the library (can you found them in the example folder) in the same folder of your .pro file
                      3-Add an include snap7.h in your widget.h file and declare a TS7Client object.
                      4-Add in your .pro file LIBS +="path\to\your\file.dll" and run qmake

                      Remember that if you write or read some data you must swap the byte of the word/longword before you send the request.

                      I hope this help all the people comes to this post !
                      That's it :)

                      Pablo J. RoginaP Offline
                      Pablo J. RoginaP Offline
                      Pablo J. Rogina
                      wrote on last edited by
                      #10

                      @markolino_it said in snap7 and Qt Creator:

                      Ok it works.
                      So this are the steps to get it works fine

                      Glad you solved it. And thank you for sharing your findings.
                      One more thing, don't forget to mark your post as solved.

                      Upvote the answer(s) that helped you solve the issue
                      Use "Topic Tools" button to mark your post as Solved
                      Add screenshots via postimage.org
                      Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                      M 1 Reply Last reply
                      1
                      • Pablo J. RoginaP Pablo J. Rogina

                        @markolino_it said in snap7 and Qt Creator:

                        Ok it works.
                        So this are the steps to get it works fine

                        Glad you solved it. And thank you for sharing your findings.
                        One more thing, don't forget to mark your post as solved.

                        M Offline
                        M Offline
                        markolino_it
                        wrote on last edited by
                        #11

                        @Pablo-J-Rogina
                        👍🏻

                        1 Reply Last reply
                        0
                        • M markolino_it

                          Ok it works.
                          So this are the steps to get it works fine:
                          1-Compile the library with file .bat to obtain .lib and .dll file.
                          Follow the instruction on snap7 site, section "rebuild".
                          2-Copy this 2 file in your folder, where found the exe file of the application
                          3-Copy the snap7.h and the snap7.cpp file of the library (can you found them in the example folder) in the same folder of your .pro file
                          3-Add an include snap7.h in your widget.h file and declare a TS7Client object.
                          4-Add in your .pro file LIBS +="path\to\your\file.dll" and run qmake

                          Remember that if you write or read some data you must swap the byte of the word/longword before you send the request.

                          I hope this help all the people comes to this post !
                          That's it :)

                          M Offline
                          M Offline
                          Mostafa1999
                          wrote on last edited by
                          #12

                          @markolino_it
                          please how can i do step 1 (compile the library with file.bat)

                          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