G ++-lpthread-g-wall-O3-d_linux _-dmmap_populate-fstrict-aliasing-wstrict-aliasing-D _ x86_64 _-C kmeans. CPP-O kmeans. o-I .. /.. /include
G ++-lpthread-g-wall-O3-d_linux _-dmmap_populate-fstrict-aliasing-wstrict-aliasing-D _ x86_64 _-O kmeans. o-lpthread-LRT-l .. /.. /lib
-Lphoenix
.../../Lib/libphoenix. A (thread_pool.o): In function 'semaphore: Wait ()':
/Home/xiuwenyi/Phoenix ++-1.0/src/../include/synch. h: 177: Undefined reference to 'sem _ wait'
.../Lib/libphoenix. A (thread_pool.o): In function 'semaphore: Post ()':
/Home/xiuwenyi/Phoenix ++-1.0/src/../include/synch. h: 168: Undefined reference to 'sem _ Post'
/Home/xiuwenyi/Phoenix ++-1.0/src/../include/synch. h: 168: Undefined reference to 'sem _ Post'
.../../Lib/libphoenix. A (thread_pool.o): In function 'maphore ':
/Home/xiuwenyi/Phoenix ++-1.0/src/../include/synch. h: 159: Undefined reference to 'sem _ init'
/Home/xiuwenyi/Phoenix ++-1.0/src/../include/synch. h: 159: Undefined reference to 'sem _ init'
.../../Lib/libphoenix. A (thread_pool.o): In function 'thread _ pooled ':
/Home/xiuwenyi/Phoenix ++-1.0/src/thread_pool.cpp: 61: Undefined reference to 'pthread _ create'
/Home/xiuwenyi/Phoenix ++-1.0/src/thread_pool.cpp: 61: Undefined reference to 'pthread _ create'
.../Lib/libphoenix. A (thread_pool.o): In function 'semaphore: Post ()':
/Home/xiuwenyi/Phoenix ++-1.0/src/../include/synch. h: 168: Undefined reference to 'sem _ Post'
.../../Lib/libphoenix. A (thread_pool.o): In function 'semaphore: Wait ()':
/Home/xiuwenyi/Phoenix ++-1.0/src/../include/synch. h: 177: Undefined reference to 'sem _ wait'
.../Lib/libphoenix. A (thread_pool.o): In function 'semaphore: Post ()':
/Home/xiuwenyi/Phoenix ++-1.0/src/../include/synch. h: 168: Undefined reference to 'sem _ Post'
.../../Lib/libphoenix. A (thread_pool.o): In function 'semaphore: Wait ()':
/Home/xiuwenyi/Phoenix ++-1.0/src/../include/synch. h: 177: Undefined reference to 'sem _ wait'
Collect2: LD returns 1
Make: *** [kmeans] Error 1
If the preceding error occurs, go to the kmeans directory, modify the makefile, and add-pthread as follows:
kmeans: $(KMEANS_OBJS) $(LIB_DEP)$(CXX) -pthread $(CFLAGS) -o $@ $(KMEANS_OBJS) $(LIBS)%.o: %.cpp$(CXX) -pthread $(CFLAGS) -c $< -o $@ -I$(HOME)/$(INC_DIR)
Enter the Phoenix folder in the terminal, make