Unsolved Snap7 and Qt ,PLC communication
-
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)?
-
Also is it enough just #include "snap7.h"
-
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"
-
Okay ,I am downloading mingw 4.7 and to download the snap7 ,you must download 1.4.2 and you will see in build folder .dll and .lib for 32 or 64 bit
-
@ZekDe
Hi
From where do u download mingw ?
Its included in Qt. ??anyway, it seems ready for mingw
so make sure to build right version 32/64 for the Qt you are using/downloaded.
-
Hi,
I'am downloading with maintanencetool -
@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 ?) -
Open source lastest version ,I don't remember I had to delete Qt because of my mistake,now I am reinstalling it.
-
@ZekDe
Ok so you will be using the mingw that comes with Qt 5.1 ? -
I am downloading all mingw versions![alt text]( image url)
-
:)
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. -
as a result,What is your offer now?
-
@ZekDe
Offer ?
All info is there. they even made .bat files to compile the DLL
so build it and link it to the Qt app.
It has clear build instruction. -
I suppose I have lack of knowledge,I dont know about .bat file.How will I use it?What does it do
-
@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. -
Check me then if I understand right.
1-->I will build a .dll using .bat according to mingw file path,I will chance in bat file.
2-->I will put in my Qt app .dll, .lib and I include the snap7.lib in .pro file
Then Qt will see both because of the .dll and .lib same folder.