When I\'m compiling openvswitch-1.5.0, I\'ve encountered the following compile error:
gcc -Wstrict-prototypes -Wall -Wno-sign-compare -Wpointer-arith
-
If you are using CMake, there are some ways that you could solve it:
Solution 1: The most elegant one
add_executable(...)
target_include_directories(...)
target_link_libraries(target_name pthread)
Solution 2: using CMake find_package
find_package(Threads REQUIRED) # this will generate the flag for CMAKE_THREAD_LIBS_INIT
add_executable(...)
target_include_directories(...)
target_link_libraries(target_name ${CMAKE_THREAD_LIBS_INIT})
Solution 3: Change CMake flags
# e.g. with C++ 17, change to other version if you need
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -pthread")