snap7代码移植编译始终报错

问题遇到的现象和发生背景

使用plc snap7,从windows中下载后复制到linux下,解压缩后按照提示使用sudo make -f x86_64_linux.mk all 编译x86_64-linux.mk文件生成.so文件使用VScode软件,编写代码添加头文件snap7.h(这是是在exmaples中的cpp中找到的),编写代码后编译始终遇到函数未定义的问题。代码主要功能就是连接plc,读取DB1的数据

用代码块功能
#include 
#include "snap7.h"
#include 
#include 
int main(int argc, char *argv[])
{   
    byte MYDATA[256]; 
    S7Object MyClient= Cli_Create();
    Cli_ConnectTo(MyClient,"192.168.0.200",0,1);
    Cli_DBRead(MyClient,1,0,16,&MYDATA);
    Cli_Disconnect(MyClient);
    Cli_Destroy(&MyClient);
    return 0;
}
运行结果及报错内容

编译报错为:/usr/bin/ld: /tmp/ccEOAZxu.o: in function main': snap.c:(.text+0x31): undefined reference to Cli_Create'
/usr/bin/ld: snap.c:(.text+0x58): undefined reference to Cli_ConnectTo' /usr/bin/ld: snap.c:(.text+0x80): undefined reference to Cli_DBRead'
/usr/bin/ld: snap.c:(.text+0x8f): undefined reference to Cli_Disconnect' /usr/bin/ld: snap.c:(.text+0x9e): undefined reference to Cli_Destroy'
collect2: error: ld returned 1 exit status

我的解答思路和尝试过的方法

我试过编译时加l和L参数 gcc -L/home/liyongkai/bishe/snap/snap7-full-1.4.2/build/bin/x86_64-linux/ -lsnap7 snap.c没有任何作用

我想要达到的结果

编译完成

移植过程报错复制出来发给我