Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Integrate SNAP7 library with Qt,.dll,.lib,makefile
I would like to use this files in Qt but How can I do, if you would like to examine
What excatly will I do.How it will be used ?My MingGW folders are in an another folders.
yuvaram last edited by
create a share library and start using
ZekDe last edited by ZekDe
Do you give me more details?
yuvaram last edited by
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:
download MinGW 126.96.36.199z 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
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?
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.
Please follow the algorithm below:
- locate your MinGW compiler (most likely it's below C:\Qt\Tools) and note the path
- locate the bat file within the Snap7 folder that you created while extracting the zip file
- open the bat file with an editor
- replace the path to the MinGW compiler within the bat file with the path you got in step 1
- save the bat file
- open a Windows Command prompt
- navigate to the Snap7 folder from step 2 with cd \path\to\snap7
- run the bat file, watch for errors
- if there are errors, post the exact error message here
- if there are no errors, you should now have a DLL and a LIB file. In that case report success here
- use the DLL and the LIB file in your project as @mrjj already suggested in your other thread
this is in .bat , and this is my minGw C:\Qt\Tools\mingw530_32\bin
now is it right?
@ZekDe Should work. Just continue and report what happens. Good luck :)
ZekDe last edited by 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]( image url)
@ZekDe: Please see again, I edited the algorithm :)
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
![alt text](image url)
and I make the command prompt run and result
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
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
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.
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:
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".
Pablo J. Rogina last edited by
@ZekDe fortunately it looks like your problem is solved, right? if so please don't forget to mark your post as such. Thanks.
When I test the program,I will do it.