diff --git a/CMakeLists.txt b/CMakeLists.txt index 36897b6..f18fe15 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,14 @@ cmake_minimum_required(VERSION 2.8) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + project(ThreadPool) add_library(threadpool_lib "include/ThreadPool.cpp") add_executable(${PROJECT_NAME} "main.cpp") target_link_libraries(${PROJECT_NAME} threadpool_lib) + +if(UNIX) + target_link_libraries(${PROJECT_NAME} threadpool_lib -pthread) +endif(UNIX) diff --git a/include/ThreadPool.h b/include/ThreadPool.h index 3608216..4690ef7 100644 --- a/include/ThreadPool.h +++ b/include/ThreadPool.h @@ -19,6 +19,7 @@ it. Using this library is your own responsibility #include #include #include +#include class ThreadPool { long numOfThreads; diff --git a/main.cpp b/main.cpp index 06c8ea1..7c4d5df 100644 --- a/main.cpp +++ b/main.cpp @@ -7,7 +7,7 @@ void SumZeroToNumber(long &num) { for (long i = 0; i <= static_cast(num); i++) { val += i; } - static_cast(num) = val; + num = val; } int main() {