我写了一个Semaphore.hpp,我声明了一个类 Semaphore 并定义了成员函数 . 我在hpp文件的头部添加了"#pragma once",这意味着这个文件只编译一次 . 但编译器会报告链接警告 . 我不知道为什么,谢谢!

2>Generating Code...
2>IPC_shared_memory.obj : warning LNK4006: "public: void __cdecl Semaphore::wait(void)" (?wait@Semaphore@@QEAAXXZ) already defined in IPC_socket.obj; second definition ignored
2>IPC_shared_memory.obj : warning LNK4006: "public: void __cdecl Semaphore::notify(void)" (?notify@Semaphore@@QEAAXXZ) already defined in IPC_socket.obj; second definition ignored
2>IPC_shared_memory.obj : warning LNK4006: "public: bool __cdecl Semaphore::tryWait(void)" (?tryWait@Semaphore@@QEAA_NXZ) already defined in IPC_socket.obj; second definition ignored
2>IPC_shared_memory.obj : warning LNK4006: "public: bool __cdecl Semaphore::waitFor(long)" (?waitFor@Semaphore@@QEAA_NJ@Z) already defined in IPC_socket.obj; second definition ignored
2>IPC_shared_memory.obj : warning LNK4006: "public: int __cdecl Semaphore::getValue(void)" (?getValue@Semaphore@@QEAAHXZ) already defined in IPC_socket.obj; second definition ignored
2>IPC_shared_memory.obj : warning LNK4006: "public: void __cdecl Semaphore::resetValue(int)" (?resetValue@Semaphore@@QEAAXH@Z) already defined in IPC_socket.obj; second definition ignored