From 6952cf9372cd075cafcd077bba20240f22b8ad26 Mon Sep 17 00:00:00 2001 From: Samer Afach Date: Thu, 8 Jun 2017 07:34:06 +0200 Subject: [PATCH] Minor fixes for moving to gcc --- CMakeLists.txt | 6 ++++++ include/ThreadPool.h | 1 + main.cpp | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) 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() {