# demo-snap7 **Repository Path**: wilson202008/demo-snap7 ## Basic Information - **Project Name**: demo-snap7 - **Description**: snap7的C++demo - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 2 - **Created**: 2021-08-19 - **Last Updated**: 2025-04-03 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # SNAP7 Demo 1. 下载snap7-full-1.4.2.7z https://sourceforge.net/projects/snap7/files/1.4.2/ 2. 解压并进入目录/snap7/build/unix 3. 编译 ``` $ sudo make -f x86_64_linux.mk install g++ -shared -fPIC -o ../bin/x86_64-linux/libsnap7.so @"filelist.txt" -L. -lpthread -lrt -O3 rm -f "filelist.txt" cp -f ../bin/x86_64-linux/libsnap7.so /usr/lib ``` 4. 进入工程,新建build文件夹 5. 构建环境 ``` $ cmake .. -- Configuring done -- Generating done -- Build files have been written to: /home/wilson/code/demo/snap7/build ``` 6. 编译代码 ``` $ make Scanning dependencies of target demo [ 25%] Building CXX object CMakeFiles/demo.dir/PLCTest.cpp.o [ 50%] Linking CXX executable demo [100%] Built target demo ``` 7. 运行 ``` $ ./demo ```