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

Compile error on MAC OS with AppleClang 8.0.0.8000042 #266

Closed
ClausKlein opened this issue Aug 9, 2019 · 5 comments
Closed

Compile error on MAC OS with AppleClang 8.0.0.8000042 #266

ClausKlein opened this issue Aug 9, 2019 · 5 comments

Comments

@ClausKlein
Copy link
Contributor

Description

With default cmake setting it run alway in problems.
Without tests, it works fine!
And with clang version 7.0.1 (tags/RELEASE_701/final) it works too.

Claus-MBP:build clausklein$ ninja -v
ninja: no work to do.
Claus-MBP:build clausklein$ cmake -L .

-- Cache values
CMAKE_BUILD_TYPE:STRING=
CMAKE_EXECUTABLE_FORMAT:STRING=MACHO
CMAKE_INSTALL_PREFIX:PATH=/usr/local
CMAKE_OSX_ARCHITECTURES:STRING=
CMAKE_OSX_DEPLOYMENT_TARGET:STRING=
CMAKE_OSX_SYSROOT:STRING=
DOCTEST_NO_INSTALL:BOOL=OFF
DOCTEST_TEST_MODE:STRING=COMPARE
DOCTEST_WITH_MAIN_IN_STATIC_LIB:BOOL=ON
DOCTEST_WITH_TESTS:BOOL=OFF
Claus-MBP:build clausklein$ 

Steps to reproduce

Claus-MBP:build clausklein$ cmake -G Ninja ..
-- The CXX compiler identification is AppleClang 8.0.0.8000042
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for C++ include pthread.h
-- Looking for C++ include pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE  
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/clausklein/Workspace/cpp/doctest/build
Claus-MBP:build clausklein$ ninja -j1 -v
[1/44] cd /Users/clausklein/Workspace/cpp/doctest/build && /opt/local/bin/cmake -P /Users/clausklein/Workspace/cpp/doctest/scripts/cmake/assemble_single_header.cmake
[2/44] /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++  -DDOCTEST_CONFIG_DISABLE -I../scripts/development_only -I../doctest/parts -Werror -pedantic -pedantic-errors -fvisibility=hidden -fstrict-aliasing -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-c++98-compat-bind-to-temporary-copy -Wno-c++98-compat-local-type-template-args -Qunused-arguments -fcolor-diagnostics   -Wno-unknown-warning-option -Wno-unneeded-internal-declaration -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable -Wno-unused-template -MD -MT examples/all_features/CMakeFiles/disabled.dir/main.cpp.o -MF examples/all_features/CMakeFiles/disabled.dir/main.cpp.o.d -o examples/all_features/CMakeFiles/disabled.dir/main.cpp.o -c ../examples/all_features/main.cpp
FAILED: examples/all_features/CMakeFiles/disabled.dir/main.cpp.o 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++  -DDOCTEST_CONFIG_DISABLE -I../scripts/development_only -I../doctest/parts -Werror -pedantic -pedantic-errors -fvisibility=hidden -fstrict-aliasing -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-c++98-compat-bind-to-temporary-copy -Wno-c++98-compat-local-type-template-args -Qunused-arguments -fcolor-diagnostics   -Wno-unknown-warning-option -Wno-unneeded-internal-declaration -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable -Wno-unused-template -MD -MT examples/all_features/CMakeFiles/disabled.dir/main.cpp.o -MF examples/all_features/CMakeFiles/disabled.dir/main.cpp.o.d -o examples/all_features/CMakeFiles/disabled.dir/main.cpp.o -c ../examples/all_features/main.cpp
In file included from ../examples/all_features/main.cpp:2:
In file included from ../scripts/development_only/doctest/doctest.h:1:
../doctest/parts/doctest_fwd.h:400:1: error: inline namespaces are a C++11 feature [-Werror,-Wc++11-inline-namespace]
DOCTEST_STD_NAMESPACE_BEGIN
^
../doctest/parts/doctest_fwd.h:390:37: note: expanded from macro 'DOCTEST_STD_NAMESPACE_BEGIN'
#define DOCTEST_STD_NAMESPACE_BEGIN _LIBCPP_BEGIN_NAMESPACE_STD
                                    ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:395:52: note: expanded from macro '_LIBCPP_BEGIN_NAMESPACE_STD'
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
                                                   ^
In file included from ../examples/all_features/main.cpp:2:
In file included from ../scripts/development_only/doctest/doctest.h:1:
../doctest/parts/doctest_fwd.h:401:18: error: 'nullptr' is a keyword in C++11 [-Werror,-Wc++11-compat]
typedef decltype(nullptr) nullptr_t;
                 ^
../doctest/parts/doctest_fwd.h:401:18: error: use of undeclared identifier 'nullptr'

Extra information

  • doptest version: v2.3.3
  • Operating System: x86_64-apple-darwin15.6.0
  • Compiler+version: Apple LLVM version 8.0.0 (clang-800.0.42.1)
@onqtam
Copy link
Member

onqtam commented Aug 9, 2019

This is perhaps the same as this one: #243

Basically you just need to tell it to use C++11 - seems that the default for that apple clang is c++98

I'll look at this when possible.

@ClausKlein
Copy link
Contributor Author

ClausKlein commented Aug 9, 2019 via email

@ClausKlein
Copy link
Contributor Author

ClausKlein commented Aug 9, 2019 via email

@ClausKlein
Copy link
Contributor Author

cmake_minimum_required(VERSION 3.0)

project(example_exe VERSION 0.0.1 LANGUAGES CXX)

find_package(doctest REQUIRED) # prepare to use doctest/doctest.h header only interface

add_executable(${PROJECT_NAME} main.cpp)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
target_link_libraries(${PROJECT_NAME} PRIVATE doctest:: doctest) # this set include path too!

@onqtam
Copy link
Member

onqtam commented Aug 11, 2019

I'll merge your PR, but I'll try something different for the C++11 issue after that.

onqtam pushed a commit that referenced this issue Aug 11, 2019
@onqtam onqtam closed this as completed in 10101a1 Aug 12, 2019
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

No branches or pull requests

2 participants