chen3feng / toft

C++ Base Library for serverside development
BSD 3-Clause "New" or "Revised" License
341 stars 160 forks source link

包含 socket.h 后,编译时报 undefined reference to `toft::Socket::Close() 错误 #126

Open lisnb opened 7 years ago

lisnb commented 7 years ago

您好~ 在使用toft的过程中,发现在包含了 toft/system/base/socket.h 这个头文件时,如果不依赖 toft/system/base:socket 的话,即使不使用这个头文件中定义的任何内容,比如:

#include "toft/system/base/socket.h"

int main() {
  return 0;
}

也会报

undefined reference to `toft::Socket::Close()'

这样的错误。 看起来和 toft::Socket 的析构函数是 inline 的,而且使用了在 cpp 中定义的 Socket::Close() 函数有关 请问您知道这是为什么么,这个是正常的么

lisnb commented 7 years ago
> g++ --version
g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-11)

> cat /etc/issue
CentOS release 6.5 (Final)
chen3feng commented 7 years ago

可能是问题,我看看

2017-09-11 9:50 GMT+08:00 lisnb notifications@github.com:

g++ --version g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-11) cat /etc/issue CentOS release 6.5 (Final)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/chen3feng/toft/issues/126#issuecomment-328395122, or mute the thread https://github.com/notifications/unsubscribe-auth/AB5-StKczuCwWB4f9qWACofFNS_fw-7Sks5shJHagaJpZM4PRIYu .