I am using a clion IDE based on cmake, my source files are named * .cc
project(server)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread")
file(GLOB SRC_FILE "main.cc" "listenfd.cc" "socket_util.cc"
"timers.cc" "network.cc" "main_event.cc")
add_executable(server ${server})
set_target_properties(server PROPERTIES LINKER_LANGUAGE CXX)
after change
add_executable(server ${server}) to
add_executable(server "main.cc")
then I solved it, I really don’t know why? after the experiment, I found that when a file is used (GLOB ....), similar to the file (GLOB "src / main.cc"), I must specify the relative path, then it works.
source
share