Snap7 and Qt ,PLC communication
-
Hello guys I have snap7 .lib and .dll for win32 and win64 ,also http://snap7.sourceforge.net is here.
How can I include these folder with Qt Mingw .This is very important for me to job
-
Hi
Unless the DLL is created with mingw compiler,
you cannot use it.
Do you know if those are for visual studio and what version ?Anyway, if you compiled them yourself, you just need to tell
it where to find DLL file and
where to find any include files.http://doc.qt.io/qt-5/third-party-libraries.html
INCLUDEPATH += 3rdparty/CatWhisperer/include LIBS += -L"3rdparty/CatWhisperer/lib" -lCatWhisperer
CatWhisperer would be snap7 or what the real file name is.
Ah, there is info about mingw on site
Make sure to read that and match with your version of
mingw.
(do not download new mingw. use the one in Qt) -
https://sourceforge.net/projects/snap7/files/1.4.2/,There are snap7 files .I have MinGW lastest version ,in this case I cannot use this now ,Am I right?How can I download in Qt old versions.MinGW 64 or 32.Also When I add library in Qt ,will the dll folder add in the project if the dll and lib in same folder (they are in project folder)?
-
Hi
Just compile the DLLs with the Qt mingw version. Should work.
Its not a good idea to use older mingw compiler than the one used to build the Qt dlls.
You will just get issues with Qt.On https://sourceforge.net/projects/snap7/files/
I dont see any mentioned of mingw. The download seems for VIsual Basic.- Also is it enough just #include "snap7.h"
Yes when you have told it where to find it in the .pro file with INCLUDEPATH
- Also is it enough just #include "snap7.h"
-
@ZekDe
Ok, hopefully its compatible with the Qt you are using.
(Qt are DLLS and too old or too new version of mingw cannot use
the prebuild Qt Dlls you have installed)What Qt version are you using ?
(and what version of mingw came with it ?) -
:)
but why ???
The Qt 5.0.2 mingw Qt contains one.
There should be no need to add extra compilers from "tools" unless you expect the one
in Qt is too new for snap7 -
Hi @ZekDe,
personally I would not use MinGW 4.7 anymore. It's an old compiler. Also Qt 5.0 and 5.1 are very early 5.x versions, I would not use them for new development. You may encounter bugs that were already fixed in later versions (we have 5.10 now!)
If there is no Snap7 version compatible with a recent MinGW, I would try to compile the library myself.
It may be more work in the beginning, but that time will be saved in later development for sure.
Just my two cent.
-
The reason that I install the all mingw because of if I need other one,is it wrong ? :), Also Maybe you saw the src folder n snap7 folder.Can I use these in my project ,in this case it is enough now.But When I try these .h and .c files ,I encountered some problems.What excatly I should do.Because this is important for my job
-
@ZekDe
Hi , yes you might be able to include the source files directly in the Qt app unless snap7 is
designed to be a lib. Installing multiple version of mingw will open up for a mess with paths etc.If directly including them (and fixing the .pro file so it can find its headers) still produces errors, it might not
allow direct use and must be build as DLL. -
@ZekDe
First read its build dosc.
You might need to alter paths to where it looks for compiler
Then open a Command prompt and run the bat file for
mingw32 or 64 (depending on what u use)
It should produce a DLL you can link to your app as described.