ZLMediaKit / ZLToolKit

一个基于C++11的轻量级网络框架,基于线程池技术可以实现大并发网络IO
MIT License
1.98k stars 586 forks source link

Compilation failed, error: redefinition of 'struct mmsghdr #253

Open DogRex opened 1 month ago

DogRex commented 1 month ago

BufferSock.app 27行定义了结构体mmsghdr,但这个已经在x86_64-linux-gnu/sys/socket.h中定义了,报重复定义的错误

"root/software/ZLMediakit/3rdpart/2LToolkit/src/Network/Buffersock.cpp:27:8: error: redefinition of 'struct mmsghdr' struct mmsghdr In file included from/usr/include/netinet/in.h:23:0from /usr/include/netdb.h:27,from /root/software/ZLMediaKit/3rdpart/ZLToolKit/src/Network/sockutil.h:21from /root/software/ZLMediaKit/3rdpart/ZLToolKit/src/Network/BufferSock.h:27from /root/software/zLMediaKit/3rdpart/ZLToolKit/src/Network/BufferSock.cpp:12 usr/include/x86_64-linux-gnu/sys/socket.h:101:8:error: previous definition of 'struct mmsghdr' struct mmsghdr 3rdpart/CMakeFiles/zltoolkit.dir/build.make:185: recipe for target '3rdpart/cMakeFiles/zltoolkit.dir/ZLToolKit/src/Network/BufferSock.cpp.o' failed

image

Please ask how to solve this issue

BufferSock.app 27行定义了结构体mmsghdr,但这个已经在x86_64-linux-gnu/sys/socket.h中定义了,报重复定义的错误

"root/software/ZLMediakit/3rdpart/2LToolkit/src/Network/Buffersock.cpp:27:8: error: redefinition of 'struct mmsghdrstruct mmsghdr f In file included from/usr/include/netinet/in.h:23:0from /usr/include/netdb.h:27,from /root/software/ZLMediaKit/3rdpart/ZLToolKit/src/Network/sockutil.h:21from /root/software/ZLMediaKit/3rdpart/ZLToolKit/src/Network/BufferSock.h:27from /root/software/zLMediaKit/3rdpart/ZLToolKit/src/Network/BufferSock.cpp:12 usr/include/x86_64-linux-gnu/sys/socket.h:101:8:error: previous definition of 'struct mmsghdrstruct mmsghdr3rdpart/CMakeFiles/zltoolkit.dir/build.make:185: recipe for target '3rdpart/cMakeFiles/zltoolkit.dir/ZLToolKit/src/Network/BufferSock.cpp.o' failec

image

请问这个应该怎么解决

TRANS_BY_GITHUB_AI_ASSISTANT

wasphin commented 1 month ago

Here is the translation of the text to English, preserving the existing formatting and punctuation:

Here it will first judge that it does not contain mmsghdr before defining https://github.com/ZLMediaKit/ZLToolKit/blob/46231014e2a7ec1903d4a37e96222481ecc779d8/CMakeLists.txt#L8

It seems that your side did not recognize it successfully, take a look at how it is defined in the system file

这里会先判断不包含 mmsghdr 才定义 https://github.com/ZLMediaKit/ZLToolKit/blob/46231014e2a7ec1903d4a37e96222481ecc779d8/CMakeLists.txt#L8

看样子你那边没识别成功,看下系统文件中是怎么定义的

TRANS_BY_GITHUB_AI_ASSISTANT