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. Integrate SNAP7 library with Qt,.dll,.lib,makefile
Qt 6.11 is out! See what's new in the release blog

Integrate SNAP7 library with Qt,.dll,.lib,makefile

Scheduled Pinned Locked Moved Solved General and Desktop
18 Posts 5 Posters 7.6k 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.
  • Z ZekDe

    Do you give me more details?

    yuvaramY Offline
    yuvaramY Offline
    yuvaram
    wrote on last edited by
    #4

    @ZekDe
    Creating library and linking to Application

    Yuvaram Aligeti
    Embedded Qt Developer
    : )

    1 Reply Last reply
    0
    • Z Offline
      Z Offline
      ZekDe
      wrote on last edited by
      #5

      The person who create dll and .lib also .bat say these

      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.

      If you don’t have it at all:

      Go to
      http://sourceforge.net/projects/orwelldevcpp/files/Compilers/MinGW/

      download MinGW 4.7.2.7z and unpack it in c:\ .

      No further settings are needed.

      To build Snap7, open a command prompt into the working folder build\windows\MinGW32 and run "make all" (or "make clean" if you want to clean the project).

      Into build\bin\win32 you will find snap7.dll and snap7.lib, the latter is the dynamic library import file to be used with C/C++ compilers (other languages don't need it).

      Libstdc++ are statically linked, so you don’t need to distribute them with your software.

      I couldnt understand what will I do.I have MinGW in an another folders.in this case I have to change the bat file content

      aha_1980A 1 Reply Last reply
      0
      • Z ZekDe

        The person who create dll and .lib also .bat say these

        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.

        If you don’t have it at all:

        Go to
        http://sourceforge.net/projects/orwelldevcpp/files/Compilers/MinGW/

        download MinGW 4.7.2.7z and unpack it in c:\ .

        No further settings are needed.

        To build Snap7, open a command prompt into the working folder build\windows\MinGW32 and run "make all" (or "make clean" if you want to clean the project).

        Into build\bin\win32 you will find snap7.dll and snap7.lib, the latter is the dynamic library import file to be used with C/C++ compilers (other languages don't need it).

        Libstdc++ are statically linked, so you don’t need to distribute them with your software.

        I couldnt understand what will I do.I have MinGW in an another folders.in this case I have to change the bat file content

        aha_1980A Offline
        aha_1980A Offline
        aha_1980
        Lifetime Qt Champion
        wrote on last edited by
        #6

        @ZekDe said in Integrate SNAP7 library with Qt,.dll,.lib,makefile:

        I have MinGW in an another folders.in this case I have to change the bat file content

        Then just do it. What is your problem with this?

        Qt has to stay free or it will die.

        1 Reply Last reply
        0
        • Z Offline
          Z Offline
          ZekDe
          wrote on last edited by
          #7

          I am electronics and communication engineer and just graduated,so my problem I dont know how I can do it.I am new in C++ and Qt.

          aha_1980A 1 Reply Last reply
          0
          • Z ZekDe

            I am electronics and communication engineer and just graduated,so my problem I dont know how I can do it.I am new in C++ and Qt.

            aha_1980A Offline
            aha_1980A Offline
            aha_1980
            Lifetime Qt Champion
            wrote on last edited by aha_1980
            #8

            @ZekDe

            Please follow the algorithm below:

            1. locate your MinGW compiler (most likely it's below C:\Qt\Tools) and note the path
            2. locate the bat file within the Snap7 folder that you created while extracting the zip file
            3. open the bat file with an editor
            4. replace the path to the MinGW compiler within the bat file with the path you got in step 1
            5. save the bat file
            6. open a Windows Command prompt
            7. navigate to the Snap7 folder from step 2 with cd \path\to\snap7
            8. run the bat file, watch for errors
            9. if there are errors, post the exact error message here
            10. if there are no errors, you should now have a DLL and a LIB file. In that case report success here
            11. use the DLL and the LIB file in your project as @mrjj already suggested in your other thread

            Qt has to stay free or it will die.

            1 Reply Last reply
            2
            • Z Offline
              Z Offline
              ZekDe
              wrote on last edited by
              #9

              path=c:\MinGW32\bin;c:\MinGW32\mingw32\bin;%PATH
              mingw32-make %1

              this is in .bat , and this is my minGw C:\Qt\Tools\mingw530_32\bin
              now is it right?

              path=C:\Qt\Tools\mingw530_32\bin;C:\Qt\Tools\mingw530_32\mingw32\bin;%PATH
              mingw32-make %1

              aha_1980A 1 Reply Last reply
              0
              • Z ZekDe

                path=c:\MinGW32\bin;c:\MinGW32\mingw32\bin;%PATH
                mingw32-make %1

                this is in .bat , and this is my minGw C:\Qt\Tools\mingw530_32\bin
                now is it right?

                path=C:\Qt\Tools\mingw530_32\bin;C:\Qt\Tools\mingw530_32\mingw32\bin;%PATH
                mingw32-make %1

                aha_1980A Offline
                aha_1980A Offline
                aha_1980
                Lifetime Qt Champion
                wrote on last edited by
                #10

                @ZekDe Should work. Just continue and report what happens. Good luck :)

                Qt has to stay free or it will die.

                1 Reply Last reply
                0
                • Z Offline
                  Z Offline
                  ZekDe
                  wrote on last edited by ZekDe
                  #11

                  navigate to the Snap7 folder with cd \path\to\snap7

                  I still didnt understand this,what is the path here.My all 3 files(.dll,.bat,lib) is in the project file ![alt text](0_1515876976613_b299263c-4a9a-4351-be59-cc3b61d02371-image.png image url)

                  aha_1980A 1 Reply Last reply
                  0
                  • Z ZekDe

                    navigate to the Snap7 folder with cd \path\to\snap7

                    I still didnt understand this,what is the path here.My all 3 files(.dll,.bat,lib) is in the project file ![alt text](0_1515876976613_b299263c-4a9a-4351-be59-cc3b61d02371-image.png image url)

                    aha_1980A Offline
                    aha_1980A Offline
                    aha_1980
                    Lifetime Qt Champion
                    wrote on last edited by
                    #12

                    @ZekDe: Please see again, I edited the algorithm :)

                    Qt has to stay free or it will die.

                    1 Reply Last reply
                    1
                    • Z Offline
                      Z Offline
                      ZekDe
                      wrote on last edited by
                      #13

                      I am confused ,this is so hard for me,What am I doing,
                      I am explaining What I did

                      I changed the bat like this path=C:\Qt\Tools\mingw530_32\bin;C:\Qt\Tools\mingw530_32\mingw32\bin;%PATH
                      mingw32-make %1 but this is like wrong.This is my path C:\Qt\Tools\mingw530_32\bin but what is this C:\Qt\Tools\mingw530_32\mingw32\bin
                      and I carried the files in project folder ,bat,makefile,dlli,lib 0_1515878526020_bf23e114-2a98-455e-93e5-55061830829c-image.png

                      0_1515878311668_f7e119a7-deee-45af-b35b-d38ce230c9ad-image.png ![alt text](image url)
                      and I make the command prompt run and result
                      0_1515878603142_ec1fe2c0-fa8b-4908-84ba-51f9a897d807-image.png

                      last one I add the lib in project file but when I include the #include "snap.h" nothings happen no snap7 file doesnt work

                      ohh I m tired

                      1 Reply Last reply
                      0
                      • Z Offline
                        Z Offline
                        ZekDe
                        wrote on last edited by
                        #14

                        hi,I have some errors,I think I got this now,but How can I do it with mingw 5.3.0 .
                        is it possible with just src files

                        mrjjM 1 Reply Last reply
                        0
                        • Z ZekDe

                          hi,I have some errors,I think I got this now,but How can I do it with mingw 5.3.0 .
                          is it possible with just src files

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

                          @ZekDe
                          To use mingw 5.3 would be 100 % the same just other paths if installed
                          in other folder than the compiler you just used.

                          • is it possible with just src files

                          We cant answer that unless someone have tried/knows snap7.
                          If the source is setup to allow non DLL/LIB use then it should work but
                          if expected to be a shared lib then error will come.

                          1 Reply Last reply
                          1
                          • Z Offline
                            Z Offline
                            ZekDe
                            wrote on last edited by
                            #16

                            Since yesterday I have extented my knowledges about compiler with people who support me like you .And finally I have asked the author and He has sent me some writing ,now I am sharing them.I have implemented the 1 option ,and during the compile I have not got an error, but I haven't applied with plc.

                            1 - use it as external library statically linked (.dll or .so in linux), to do this add snap7.cpp and snap7.h into your source project and add snap7.lib into the external library list (usually it's a linker option) .
                            Snap7.cpp defines the objects and snap7.lib contains the binary interface to snap7.dll.
                            Use the correct snap7.lib since it must meet your model (32 or 64 bit).
                            With this method snap7.dll must be copied into the executable folder of your project.

                            2 - embedd snap7 directly into your project at source level. With this method snap7 will be compiled with your project regardless of 32/64 bit architecture, and you dont' need to distribute snap7.dll.
                            In this way you dont need of snap7.cpp, snap7.h and snap7.lib, just add to your project the source files needed in accord to this:
                            http://snap7.sourceforge.net/snap7_source.html#embed_mc

                            As said, snap7 is a standard library, the tasks that you need to do are exactly the same of all other 3th party libraries.
                            If you are new of c++/qt programming just do:
                            google-->"qt creator external libraries".
                            Regards

                            1 Reply Last reply
                            2
                            • Pablo J. RoginaP Offline
                              Pablo J. RoginaP Offline
                              Pablo J. Rogina
                              wrote on last edited by
                              #17

                              @ZekDe fortunately it looks like your problem is solved, right? if so please don't forget to mark your post as such. Thanks.

                              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

                              1 Reply Last reply
                              0
                              • Z Offline
                                Z Offline
                                ZekDe
                                wrote on last edited by
                                #18

                                When I test the program,I will do it.

                                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