我有客户端服务器代码。LinServer.cpp 使用 pthread 持续监听客户端。我创建了 make 文件来编译所有内容:
all: LinServer LinClient
LinServer:
g++ LinServer.cpp -o LinServer -pthread
LinClient:
g++ LinClient.cpp -o LinClient -pthread
我也试过 -lpthread 但同样的错误:
LinServer.cpp:(.text+0x29b): undefined reference to `pthread_create'
LinServer.cpp:(.text+0x2a7): undefined reference to `pthread_detach'
collect2: error: ld returned 1 exit status
make: *** [LinServer] Error 1
知道这里有什么问题吗?