出错的顺序 -g -o iec61850_test -lutil -lslog -lmem -lmlog -lpthread
magic c++ 报错:
make -f iec61850_test_DEBUG.mk ...
gcc -c -o test.o -c -g -I/root/iec61850_test/inc -I/root/iec61850_test/inc/mmsop_en test.c
gcc -c -o iec61850_zk.o -c -g -I/root/iec61850_test/inc -I/root/iec61850_test/inc/mmsop_en iec61850_zk.c
gcc -c -o client.o -c -g -I/root/iec61850_test/inc -I/root/iec61850_test/inc/mmsop_en client.c
gcc -g -o iec61850_test -L/root/iec61850_test/lib test.o iec61850_zk.o client.o -lutil -lslog -lmem -lmlog -lpthread
/root/iec61850_test/lib/libmem.a(mem_chks.o)(.text+0xe61): In function `x_chk_free':
//linuxsvr/root/iec61850/src/mem_chks.c(1073): undefined reference to `_slogHex'
/root/iec61850_test/lib/libmem.a(mem_chks.o)(.text+0x1526): In function `chk_alloc_ptr':
//linuxsvr/root/iec61850/src/mem_chks.c(1515): undefined reference to `_slogHex'
/root/iec61850_test/lib/libmem.a(mem_chks.o)(.text+0x180b): In function `check_mem_list':
//linuxsvr/root/iec61850/src/mem_chks.c(1631): undefined reference to `_slogHex'
collect2: ld returned 1 exit status
make: *** [iec61850_test] Error 1
Leave the directory: /root/iec61850_test
交换 -lslog -lmem 顺序后,编译成功。
linux静态库引用顺序问题
最新推荐文章于 2024-01-07 12:09:46 发布