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 Updated to NodeBB v4.3 + New Features

snap7 and Qt Creator

Scheduled Pinned Locked Moved Solved General and Desktop
12 Posts 5 Posters 1.4k Views 3 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.
  • 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 Offline
        Christian EhrlicherC Offline
        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 Offline
            Christian EhrlicherC Offline
            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