我正在编写一个 OOP 代码,我需要在文件之间共享一个结构。我将结构放在 .h 文件的末尾并包含它。如:
struct icsData
{
AudioBuilder *audioBPtr;
}icsDataPtr;
然后我收到以下错误:
NetworkSocket.o:(.bss+0x0): multiple definition of `icsDataPtr'
main.o:(.bss+0x0): first defined here
AudioCore.o:(.bss+0x10): multiple definition of `icsDataPtr'
main.o:(.bss+0x0): first defined here
AudioBuilder.o:(.bss+0x0): multiple definition of `icsDataPtr'
main.o:(.bss+0x0): first defined here
AudioInterface.o:(.bss+0x0): multiple definition of `icsDataPtr'
main.o:(.bss+0x0): first defined here
ChannelEndpoint.o:(.bss+0x0): multiple definition of `icsDataPtr'
main.o:(.bss+0x0): first defined here
Device.o:(.bss+0x0): multiple definition of `icsDataPtr'
main.o:(.bss+0x0): first defined here
MainCore.o:(.bss+0x0): multiple definition of `icsDataPtr'
main.o:(.bss+0x0): first defined here
MicroHandShake.o:(.bss+0x0): multiple definition of `icsDataPtr'
main.o:(.bss+0x0): first defined here
FrameBuilder.o:(.bss+0x0): multiple definition of `icsDataPtr'
main.o:(.bss+0x0): first defined here
RealTimeStatus.o:(.bss+0x0): multiple definition of `icsDataPtr'
main.o:(.bss+0x0): first defined here
collect2: error: ld returned 1 exit status
make: *** [eCom] Error 1
问:可以分享吗?