1>F:\shared_bike3\obj\x64\Debug\DispatchMsgService.o : error : In function LoginReqEv::LoginReqEv(st

虚函数问题

  • 遇到的问题
  • 解决的办法(英文)
  • 解决的办法(中文)
  • 解决的办法(简单来说)
  • 效果

遇到的问题

1>F:\shared_bike3\obj\x64\Debug\DispatchMsgService.o : error : In function LoginReqEv::LoginReqEv(std::__cxx11::basic_string const&, int)': 1>F:\shared_bike3\events_def.h(67): error : undefined reference to vtable for LoginReqEv’1>collect2 : error : ld returned 1 exit status

解决的办法(英文)

This error message suggests that there is an issue with the compilation and linking of the DispatchMsgService.o object file. Specifically, it appears that there is an undefined reference to the virtual table (vtable) for the LoginReqEv class, which is causing the linker to fail with an exit status of 1.

One possible cause of this error is that the LoginReqEv class has a virtual function that is declared but not defined. This can result in an undefined reference to the vtable, as the linker needs to know the address of all virtual functions in order to properly construct the vtable.

To resolve this error, you should check the definition of the LoginReqEv class and ensure that all virtual functions are properly defined. You may also want to check that all necessary header files are included and that the appropriate libraries are linked.

It’s also worth noting that this error message is specific to the Microsoft Visual C++ compiler, so if you are using a different compiler, the error message may be slightly different. However, the underlying issue is likely to be the same.

解决的办法(中文)

此错误消息表明DispatchMsgService.o对象文件的编译和链接存在问题。具体来说,LoginReqEv类的虚拟表(vtable)似乎存在未定义的引用,这导致链接器失败,退出状态为1。
此错误的一个可能原因是LoginReqEv类具有声明但未定义的虚函数。这可能导致对vtable的未定义引用,因为链接器需要知道所有虚函数的地址以便正确地构造vtable。
若要解决此错误,应检查LoginReqEv类的定义,并确保正确定义了所有虚函数。您可能还需要检查是否包含了所有必要的头文件,以及是否链接了相应的库。
同样值得注意的是,此错误消息特定于Microsoft Visual C++编译器,因此如果您使用不同的编译器,则错误消息可能略有不同。然而,根本的问题可能是相同的。

解决的办法(简单来说)

你作为基类,有未实现的虚函数,你现在需要去实现"未实现的虚函数"

效果

在这里插入图片描述

你可能感兴趣的:(共享单车,服务器,linux)