本文介绍了Makefile和SNAP7的关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好朋友,我缺乏关于makefile的信息。你能不能帮我理解那个事件。我现在设法通过PC和PLC传输来自SNAP7文件的makefile,另一个是来自QT Creature的.pro文件。你能解释一下MakeFile的内容吗。
#
#MinGW 32 makefile
#
#更改变量MINGW和MINREL符合你的编译器路径/释放
#
MINGW = C:/ MinGW32
MINREL = 4.7.2
#
#
CPP = g ++。exe
CC = gcc.exe
TEMP = .. / .. / temp
OBJ = $(TEMP)/win32/snap_msgsock.o $(TEMP)/ win32 / snap_sysutils。 o $(TEMP)/win32/snap_tcpsrvr.o $(TEMP)/win32/snap_threads.o $(TEMP)/win32/s7_client.o $(TEMP)/win32/s7_isotcp.o $(TEMP)/ win32 / s7_micro_client。 o $(TEMP)/win32/s7_partner.o $(TEMP)/win32/s7_peer.o $(TEMP)/win32/s7_server.o $(TEMP)/win32/s7_text.o $(TEMP)/ win32 / snap7_libmain。 o
LINKOBJ = $(TEMP)/win32/snap_msgsock.o $(TEMP)/win32/snap_sysutils.o $(T EMP)/win32/snap_tcpsrvr.o $(TEMP)/win32/snap_threads.o $(TEMP)/win32/s7_client.o $(TEMP)/win32/s7_isotcp.o $(TEMP)/win32/s7_micro_client.o $( TEMP)/win32/s7_partner.o $(TEMP)/win32/s7_peer.o $(TEMP)/win32/s7_server.o $(TEMP)/win32/s7_text.o $(TEMP)/win32/snap7_libmain.o
LIBS = -L$(MINGW)/ lib-static-libgcc --no-export-all-symbols --add -stdcall-alias $(MINGW)/lib/libws2_32.a $(MINGW)/ lib /libwinmm.a $(MINGW)/ lib / gcc / mingw32 / $(MINREL)/ libstdc ++。
INCS = -I$(MINGW)/ include-I../../ .. / src / sys-I../../../ src / core-I../../../ src / lib
CXXINCS = -I$(MINGW) / include-I../../../ src / sys-I../../../ src / core-I../../../ src / lib
OUTPATH = ../../bin/Legacy/win32/
DLL = snap7.dll
OUTLIB = $(OUTPATH)snap7.lib
BIN = $(OUTPATH )$(DLL)
CXXFLAGS = $(CXXINCS)-DBUILDING_DLL = 1 -Ofast -pedantic
CFLAGS = $(INCS)-DBUILDING_DLL = 1
RM = rm -f
.PHONY:所有全部清洗后全部清洁 - 自定义
所有:a ll-before $(BIN)all-after
DLLWRAP = dllwrap.exe
DLLTOOL = dlltool.exe
DEFFILE = $(OUTPATH)snap7.def
clean:clean-custom
$ {RM} $(OBJ)$(BIN)$(OUTLIB)$(DEFFILE)
$(BIN):$(LINKOBJ)
$(DLLWRAP) - output-def $(DEFFILE) - driver-name c ++ $(LINKOBJ)$(LIBS)-o $(BIN)
$(TEMP)/ win32 /snap_msgsock.o:../../../src/sys/snap_msgsock.cpp
$(CPP)-c ../../../src/sys/snap_msgsock.cpp -o $ (TEMP)/win32/snap_msgsock.o $(CXXFLAGS)
$(TEMP)/win32/snap_sysutils.o:../../../src/sys/snap_sysutils.cpp
$(CPP)-c ../../../src/sys/snap_sysutils.cpp -o $(TEMP)/win32/snap_sysutils.o $(CXXFLAGS)
$( TEMP)/win32/snap_tcpsrvr.o:../../../src/sys/snap_tcpsrvr.cpp
$(CPP)-c ../../../src/sys/snap_tcpsrvr。 cpp -o $(TEMP)/win32/snap_tcpsrvr.o $(CXXFLAGS)
$(TEMP)/win32/snap_threads.o:../../../src/sys/snap_threads .cpp
$(CPP)-c ../../../src/sys/snap_threads.cpp -o $(TEMP)/win32/snap_threads.o $(CXXFLAGS)
$(TEMP)/win32/s7_client.o:../../../src/core/s7_client.cpp
$(CPP)-c ../../../src/ core / s7_client.cpp -o $(TEMP)/win32/s7_client.o $(CXXFLAGS)
$(TEMP)/win32/s7_isotcp.o:../../../src /core/s7_isotcp.cpp
$(CPP)-c ../../../src/core/s7_isotcp.cpp -o $(TEMP)/win32/s7_isotcp.o $(CXXFLAGS)
$(TEMP)/win32/s7_micro_client.o:../../../src/core/s7_micro_client.cpp
$(CPP)-c ../../。 ./src/core/s7_micro_client.cpp -o $(TEMP)/win32/s7_micro_client.o $(CXXFLAGS)
$(TEMP)/win32/s7_partner.o:../../ ../src/core/s7_partner.cpp
$(CPP)-c ../../../src/core/s7_partner.cpp -o $(TEMP)/win32/s7_partner.o $( CXXFLAGS)
$(TEMP)/win32/s7_peer.o:../../../src/core/s7_peer.cpp
$(CPP)-c ../ ../../src/core/s7_peer.cpp -o $(TEMP)/win32/s7_peer.o $(CXXFLAGS)
$(TEMP)/win32/s7_server.o:.. /../../src/core/s7_server.cpp
$(CPP)-c ../../../src/core/s7_server.cpp -o $(TEMP)/ win32 / s7_server .o $(CXXFLAGS)
$(TEMP)/win32/s7_text.o :../../../src/core/s7_text.cpp
$(CPP)-c ../../../scrc/core/s7_text.cpp -o $(TEMP)/ win32 / s7_text.o $(CXXFLAGS)
$(TEMP)/win32/snap7_libmain.o:../../../src/lib/snap7_libmain.cpp
$( CPP)-c ../../../src/lib/snap7_libmain.cpp -o $(TEMP)/win32/snap7_libmain.o $(CXXFLAGS)
all-after:
$(DLLTOOL)-D $(DLL)-d $(DEFFILE)-l $(OUTLIB)
我尝试过:
#------------------ -------------------------------
#
#项目由QtCreator创建2018-01-19T16 :14:23
#
#------------------------------------ -------------
QT + =核心gui
greaterThan(QT_MAJOR_VERSION,4):QT + =小部件
TARGET = C41
TEMPLATE = app
#如果您使用
#任何已被标记为已弃用的Qt功能,则以下定义会使您的编译器发出警告(确切的警告
#取决于你的编译器)。请参阅
#deprecated API的文档,以了解如何从中移除代码。
DEFINES + = QT_DEPRECATED_WARNINGS
#如果使用不推荐使用的API,也可以使代码无法编译。
#为此,请取消注释以下行。
#您还可以选择仅在特定版本的Qt中禁用已弃用的API。
#DEFINES + = QT_DISABLE_DEPRECATED_BEFORE = 0x060000#禁用在Qt 6.0.0之前弃用的所有API
win32:LIBS + = C:\ Qt \Tools \mingw530_32 \i686-w64-mingw32 \lib \libws2_32.a
win32:LIBS + = C:\ Qt \Tools \\\ tingw530_32 \ i686-w64-mingw32 \lib \ libwinmm.a
INCLUDEPATH + = C:\ Users\Emrah\Desktop\snap7-full-1.4.2 \snap7-full-1.4.2 \ release.com \\ Wrappers\c- cpp
INCLUDEPATH + = C:\Users\Emrah\Desktop\snap7-full-1.4.2 \snap7-full-1.4.2 \ src \ core
INCLUDEPATH + = C:\ Users\Emrah \Desktop\snap7-full-1.4.2 \snap7-full-1.4.2 \ src \ lib
INCLUDEPATH + = C:\ Users \ Emrah \Desktop\snap7-full-1.4.2\snap7-full-1.4.2\src\sys
SOURCES + = \
main.cpp \
mainwindow.cpp \
../../snap7-full-1.4.2/snap7-full-1.4.2/src/core/s7_clien t.cpp \
../../snap7-full-1.4.2/snap7-full-1.4.2/src/core/s7_isotcp.cpp \
../../ snap7-full-1.4.2 / snap7-full-1.4.2 / src / core / s7_micro_client.cpp \
../../snap7-full-1.4.2/snap7-full-1.4.2 /src/core/s7_partner.cpp \
../../snap7-full-1.4.2/snap7-full-1.4.2/src/core/s7_peer.cpp \
。 ./../snap7-full-1.4.2/snap7-full-1.4.2/src/core/s7_server.cpp \
../../snap7-full-1.4.2/snap7- full-1.4.2 / src / core / s7_text.cpp \
../../snap7-full-1.4.2/snap7-full-1.4.2/src/lib/snap7_libmain.cpp \
../../snap7-full-1.4.2/snap7-full-1.4.2/src/sys/snap_msgsock.cpp \
../../snap7-full-1.4 .2 / snap7-full-1.4.2 / src / sys / snap_sysutils.cpp \
../../snap7-full-1.4.2/snap7-full-1.4.2/src/sys/ snap_tcpsrvr.cpp \
../../snap7-full-1.4.2/snap7-full-1.4.2/src/sys/snap_threads.cpp \
../../ snap7-full-1.4.2 / snap7-full-1.4.2 / release / Wrappers / c-cpp / snap7.cpp \
dialo gdkcs.cpp
HEADERS + = \
mainwindow.h \
../../snap7-full-1.4.2/snap7-full-1.4.2 /src/core/s7_client.h \
../../snap7-full-1.4.2/snap7-full-1.4.2/src/core/s7_firmware.h \
。 ./../snap7-full-1.4.2/snap7-full-1.4.2/src/core/s7_isotcp.h \
../../snap7-full-1.4.2/snap7- full-1.4.2 / src / core / s7_micro_client.h \
../../snap7-full-1.4.2/snap7-full-1.4.2/src/core/s7_partner.h \
../../snap7-full-1.4.2/snap7-full-1.4.2/src/core/s7_peer.h \
../../snap7-full-1.4 .2 / snap7-full-1.4.2 / src / core / s7_server.h \
../../snap7-full-1.4.2/snap7-full-1.4.2/src/core/ s7_text.h \
../../snap7-full-1.4.2/snap7-full-1.4.2/src/core/s7_types.h \
../../ snap7-full-1.4.2 / snap7-full-1.4.2 / src / lib / snap7_libmain.h \
../../snap7-full-1.4.2/snap7-full-1.4.2 /src/sys/snap_msgsock.h \
../../snap7-full-1.4.2/snap7-full-1.4.2/src/sys/snap_platform.h \
../../snap7-full-1.4.2/snap7-full-1.4.2/src/sys/snap_sysutils.h \
../../snap7-full -1.4.2 / snap7-full-1.4.2 / src / sys / snap_tcpsrvr.h \
../../snap7-full-1.4.2/snap7-full-1.4.2/src/ sys / snap_threads.h \
../../snap7-full-1.4.2/snap7-full-1.4.2/src/sys/sol_threads.h \
../。 ./snap7-full-1.4.2/snap7-full-1.4.2/src/sys/unix_threads.h \
../../snap7-full-1.4.2/snap7-full-1.4 .2 / src / sys / win_threads.h \
../../snap7-full-1.4.2/snap7-full-1.4.2/release/Wrappers/c-cpp/snap7.h \\ \\
dialogdkcs.h
FORMS + = \
mainwindow.ui \
dialogdkcs.ui
RESOURCES + = \
picture.qrc
解决方案
Hello friends,I have lack of information about makefile.Could you help me to understand that event.I managed to be communicated PC and PLC now that is makefile from SNAP7 file and other one is my .pro file from QT Creature.Could you explain MakeFile content.
# # MinGW 32 makefile # # Change vars MINGW and MINREL in accord to your compiler path/release # MINGW =C:/MinGW32 MINREL =4.7.2 # # CPP = g++.exe CC = gcc.exe TEMP =../../temp OBJ = $(TEMP)/win32/snap_msgsock.o $(TEMP)/win32/snap_sysutils.o $(TEMP)/win32/snap_tcpsrvr.o $(TEMP)/win32/snap_threads.o $(TEMP)/win32/s7_client.o $(TEMP)/win32/s7_isotcp.o $(TEMP)/win32/s7_micro_client.o $(TEMP)/win32/s7_partner.o $(TEMP)/win32/s7_peer.o $(TEMP)/win32/s7_server.o $(TEMP)/win32/s7_text.o $(TEMP)/win32/snap7_libmain.o LINKOBJ = $(TEMP)/win32/snap_msgsock.o $(TEMP)/win32/snap_sysutils.o $(TEMP)/win32/snap_tcpsrvr.o $(TEMP)/win32/snap_threads.o $(TEMP)/win32/s7_client.o $(TEMP)/win32/s7_isotcp.o $(TEMP)/win32/s7_micro_client.o $(TEMP)/win32/s7_partner.o $(TEMP)/win32/s7_peer.o $(TEMP)/win32/s7_server.o $(TEMP)/win32/s7_text.o $(TEMP)/win32/snap7_libmain.o LIBS = -L"$(MINGW)/lib" -static-libgcc --no-export-all-symbols --add-stdcall-alias $(MINGW)/lib/libws2_32.a $(MINGW)/lib/libwinmm.a $(MINGW)/lib/gcc/mingw32/$(MINREL)/libstdc++.a INCS = -I"$(MINGW)/include" -I"../../../src/sys" -I"../../../src/core" -I"../../../src/lib" CXXINCS = -I"$(MINGW)/include" -I"../../../src/sys" -I"../../../src/core" -I"../../../src/lib" OUTPATH = ../../bin/Legacy/win32/ DLL = snap7.dll OUTLIB = $(OUTPATH)snap7.lib BIN = $(OUTPATH)$(DLL) CXXFLAGS = $(CXXINCS) -DBUILDING_DLL=1 -Ofast -pedantic CFLAGS = $(INCS) -DBUILDING_DLL=1 RM = rm -f .PHONY: all all-before all-after clean clean-custom all: all-before $(BIN) all-after DLLWRAP=dllwrap.exe DLLTOOL=dlltool.exe DEFFILE=$(OUTPATH)snap7.def clean: clean-custom ${RM} $(OBJ) $(BIN) $(OUTLIB) $(DEFFILE) $(BIN): $(LINKOBJ) $(DLLWRAP) --output-def $(DEFFILE) --driver-name c++ $(LINKOBJ) $(LIBS) -o $(BIN) $(TEMP)/win32/snap_msgsock.o: ../../../src/sys/snap_msgsock.cpp $(CPP) -c ../../../src/sys/snap_msgsock.cpp -o $(TEMP)/win32/snap_msgsock.o $(CXXFLAGS) $(TEMP)/win32/snap_sysutils.o: ../../../src/sys/snap_sysutils.cpp $(CPP) -c ../../../src/sys/snap_sysutils.cpp -o $(TEMP)/win32/snap_sysutils.o $(CXXFLAGS) $(TEMP)/win32/snap_tcpsrvr.o: ../../../src/sys/snap_tcpsrvr.cpp $(CPP) -c ../../../src/sys/snap_tcpsrvr.cpp -o $(TEMP)/win32/snap_tcpsrvr.o $(CXXFLAGS) $(TEMP)/win32/snap_threads.o: ../../../src/sys/snap_threads.cpp $(CPP) -c ../../../src/sys/snap_threads.cpp -o $(TEMP)/win32/snap_threads.o $(CXXFLAGS) $(TEMP)/win32/s7_client.o: ../../../src/core/s7_client.cpp $(CPP) -c ../../../src/core/s7_client.cpp -o $(TEMP)/win32/s7_client.o $(CXXFLAGS) $(TEMP)/win32/s7_isotcp.o: ../../../src/core/s7_isotcp.cpp $(CPP) -c ../../../src/core/s7_isotcp.cpp -o $(TEMP)/win32/s7_isotcp.o $(CXXFLAGS) $(TEMP)/win32/s7_micro_client.o: ../../../src/core/s7_micro_client.cpp $(CPP) -c ../../../src/core/s7_micro_client.cpp -o $(TEMP)/win32/s7_micro_client.o $(CXXFLAGS) $(TEMP)/win32/s7_partner.o: ../../../src/core/s7_partner.cpp $(CPP) -c ../../../src/core/s7_partner.cpp -o $(TEMP)/win32/s7_partner.o $(CXXFLAGS) $(TEMP)/win32/s7_peer.o: ../../../src/core/s7_peer.cpp $(CPP) -c ../../../src/core/s7_peer.cpp -o $(TEMP)/win32/s7_peer.o $(CXXFLAGS) $(TEMP)/win32/s7_server.o: ../../../src/core/s7_server.cpp $(CPP) -c ../../../src/core/s7_server.cpp -o $(TEMP)/win32/s7_server.o $(CXXFLAGS) $(TEMP)/win32/s7_text.o: ../../../src/core/s7_text.cpp $(CPP) -c ../../../src/core/s7_text.cpp -o $(TEMP)/win32/s7_text.o $(CXXFLAGS) $(TEMP)/win32/snap7_libmain.o: ../../../src/lib/snap7_libmain.cpp $(CPP) -c ../../../src/lib/snap7_libmain.cpp -o $(TEMP)/win32/snap7_libmain.o $(CXXFLAGS) all-after: $(DLLTOOL) -D $(DLL) -d $(DEFFILE) -l $(OUTLIB)
What I have tried:
#------------------------------------------------- # # Project created by QtCreator 2018-01-19T16:14:23 # #------------------------------------------------- QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = C41 TEMPLATE = app # The following define makes your compiler emit warnings if you use # any feature of Qt which has been marked as deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 win32:LIBS += C:\Qt\Tools\mingw530_32\i686-w64-mingw32\lib\libws2_32.a win32:LIBS += C:\Qt\Tools\mingw530_32\i686-w64-mingw32\lib\libwinmm.a INCLUDEPATH += C:\Users\Emrah\Desktop\snap7-full-1.4.2\snap7-full-1.4.2\release\Wrappers\c-cpp INCLUDEPATH += C:\Users\Emrah\Desktop\snap7-full-1.4.2\snap7-full-1.4.2\src\core INCLUDEPATH +=C:\Users\Emrah\Desktop\snap7-full-1.4.2\snap7-full-1.4.2\src\lib INCLUDEPATH +=C:\Users\Emrah\Desktop\snap7-full-1.4.2\snap7-full-1.4.2\src\sys SOURCES += \ main.cpp \ mainwindow.cpp \ ../../snap7-full-1.4.2/snap7-full-1.4.2/src/core/s7_client.cpp \ ../../snap7-full-1.4.2/snap7-full-1.4.2/src/core/s7_isotcp.cpp \ ../../snap7-full-1.4.2/snap7-full-1.4.2/src/core/s7_micro_client.cpp \ ../../snap7-full-1.4.2/snap7-full-1.4.2/src/core/s7_partner.cpp \ ../../snap7-full-1.4.2/snap7-full-1.4.2/src/core/s7_peer.cpp \ ../../snap7-full-1.4.2/snap7-full-1.4.2/src/core/s7_server.cpp \ ../../snap7-full-1.4.2/snap7-full-1.4.2/src/core/s7_text.cpp \ ../../snap7-full-1.4.2/snap7-full-1.4.2/src/lib/snap7_libmain.cpp \ ../../snap7-full-1.4.2/snap7-full-1.4.2/src/sys/snap_msgsock.cpp \ ../../snap7-full-1.4.2/snap7-full-1.4.2/src/sys/snap_sysutils.cpp \ ../../snap7-full-1.4.2/snap7-full-1.4.2/src/sys/snap_tcpsrvr.cpp \ ../../snap7-full-1.4.2/snap7-full-1.4.2/src/sys/snap_threads.cpp \ ../../snap7-full-1.4.2/snap7-full-1.4.2/release/Wrappers/c-cpp/snap7.cpp \ dialogdkcs.cpp HEADERS += \ mainwindow.h \ ../../snap7-full-1.4.2/snap7-full-1.4.2/src/core/s7_client.h \ ../../snap7-full-1.4.2/snap7-full-1.4.2/src/core/s7_firmware.h \ ../../snap7-full-1.4.2/snap7-full-1.4.2/src/core/s7_isotcp.h \ ../../snap7-full-1.4.2/snap7-full-1.4.2/src/core/s7_micro_client.h \ ../../snap7-full-1.4.2/snap7-full-1.4.2/src/core/s7_partner.h \ ../../snap7-full-1.4.2/snap7-full-1.4.2/src/core/s7_peer.h \ ../../snap7-full-1.4.2/snap7-full-1.4.2/src/core/s7_server.h \ ../../snap7-full-1.4.2/snap7-full-1.4.2/src/core/s7_text.h \ ../../snap7-full-1.4.2/snap7-full-1.4.2/src/core/s7_types.h \ ../../snap7-full-1.4.2/snap7-full-1.4.2/src/lib/snap7_libmain.h \ ../../snap7-full-1.4.2/snap7-full-1.4.2/src/sys/snap_msgsock.h \ ../../snap7-full-1.4.2/snap7-full-1.4.2/src/sys/snap_platform.h \ ../../snap7-full-1.4.2/snap7-full-1.4.2/src/sys/snap_sysutils.h \ ../../snap7-full-1.4.2/snap7-full-1.4.2/src/sys/snap_tcpsrvr.h \ ../../snap7-full-1.4.2/snap7-full-1.4.2/src/sys/snap_threads.h \ ../../snap7-full-1.4.2/snap7-full-1.4.2/src/sys/sol_threads.h \ ../../snap7-full-1.4.2/snap7-full-1.4.2/src/sys/unix_threads.h \ ../../snap7-full-1.4.2/snap7-full-1.4.2/src/sys/win_threads.h \ ../../snap7-full-1.4.2/snap7-full-1.4.2/release/Wrappers/c-cpp/snap7.h \ dialogdkcs.h FORMS += \ mainwindow.ui \ dialogdkcs.ui RESOURCES += \ picture.qrc
解决方案
这篇关于Makefile和SNAP7的关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!