Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace usleep with std::this_thread::sleep_for #260

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

arntanguy
Copy link

As reported in issue #207 , with some version of Eigen compilation fails with errors regarding usleep not being found.

This can be solved in one of two ways, including the proper header unistd.h, that was removed from Eigen headers, or better yet, using the now standard C++11 std::this_thread::sleep_for.

This commit does the latter for all uses of usleep.
A similar change was also proposed as part of the more general PR #215 , that intends to fix multiplateform compilation.

@Introvertuous
Copy link

+1

@meitiever
Copy link

how could i specify compiler C++11 in build.sh?
thanks

@arntanguy
Copy link
Author

@meitiever This is already specified in the CMakeList

include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
   add_definitions(-DCOMPILEDWITHC11)
   message(STATUS "Using flag -std=c++11.")
elseif(COMPILER_SUPPORTS_CXX0X)
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
   add_definitions(-DCOMPILEDWITHC0X)
   message(STATUS "Using flag -std=c++0x.")
else()
   message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()

@facontidavide
Copy link

+1 for this PR

Copy link

@aravindev aravindev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes do work.

@GSORF
Copy link

GSORF commented Nov 5, 2017

Please merge this PR.

thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants