-
Couldn't load subscription status.
- Fork 7
Open
@congliu0704
Description
Issue Summary
boost should be updated to latest version 1.83.0 so that on macOS in Xcode 15.0 the replacement of std::__unary_function over std::unary_function would not produce error.
Otherwise, we have error such as
CMake: Configure
[main] Configuring project: leetcode
[proc] Executing command: /usr/local/bin/cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/clang -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/clang++ -S/Users/congliu/johnhany/leetcode -B/Users/congliu/johnhany/leetcode/build -G "Unix Makefiles"
[cmake] Not searching for unused variables given on the command line.
[cmake] -- Detected MacOS platform
[cmake] -- Found Boost: /usr/local/Cellar/boost/boost@1.76/lib/cmake/Boost-1.76.0/BoostConfig.cmake (found version "1.76.0") found components: unit_test_framework
[cmake] -- Configuring done (0.1s)
[cmake] -- Generating done (0.0s)
[cmake] -- Build files have been written to: /Users/congliu/johnhany/leetcode/build
CMake: Build
[main] Building folder: leetcode
[build] Starting build
[proc] Executing command: /usr/local/bin/cmake --build /Users/congliu/johnhany/leetcode/build --config Debug --target all -j 10 --
[build] [ 25%] Building CXX object CMakeFiles/solution.dir/028-Find-the-Index-of-the-First-Occurrence-in-a-String/solution.cpp.o
[build] [ 50%] Linking CXX static library libsolution.a
[build] [ 50%] Built target solution
[build] [ 75%] Building CXX object CMakeFiles/test_main.dir/028-Find-the-Index-of-the-First-Occurrence-in-a-String/solution_test.cpp.o
[build] In file included from /Users/congliu/johnhany/leetcode/028-Find-the-Index-of-the-First-Occurrence-in-a-String/solution_test.cpp:6:
[build] In file included from /usr/local/Cellar/boost@1.76/1.76.0_4/include/boost/test/unit_test.hpp:18:
[build] In file included from /usr/local/Cellar/boost@1.76/1.76.0_4/include/boost/test/test_tools.hpp:54:
[build] In file included from /usr/local/Cellar/boost@1.76/1.76.0_4/include/boost/test/tools/fpc_op.hpp:19:
[build] In file included from /usr/local/Cellar/boost@1.76/1.76.0_4/include/boost/test/tools/fpc_tolerance.hpp:19:
[build] In file included from /usr/local/Cellar/boost@1.76/1.76.0_4/include/boost/test/tree/decorator.hpp:22:
[build] In file included from /usr/local/Cellar/boost@1.76/1.76.0_4/include/boost/test/tree/fixture.hpp:21:
[build] In file included from /usr/local/Cellar/boost@1.76/1.76.0_4/include/boost/function/function0.hpp:11:
[build] In file included from /usr/local/Cellar/boost@1.76/1.76.0_4/include/boost/function/detail/maybe_include.hpp:15:
[build] In file included from /usr/local/Cellar/boost@1.76/1.76.0_4/include/boost/function/function_template.hpp:13:
[build] In file included from /usr/local/Cellar/boost@1.76/1.76.0_4/include/boost/function/detail/prologue.hpp:17:
[build] In file included from /usr/local/Cellar/boost@1.76/1.76.0_4/include/boost/function/function_base.hpp:21:
[build] In file included from /usr/local/Cellar/boost@1.76/1.76.0_4/include/boost/type_index.hpp:29:
[build] In file included from /usr/local/Cellar/boost@1.76/1.76.0_4/include/boost/type_index/stl_type_index.hpp:47:
[build] /usr/local/Cellar/boost@1.76/1.76.0_4/include/boost/container_hash/hash.hpp:131:33: error: no template named 'unary_function' in namespace 'std'; did you mean '__unary_function'?
[build] struct hash_base : std::unary_function<T, std::size_t> {};
[build] ~~~~~^
[build] /Applications/Xcode_15_1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/__functional/unary_function.h:46:1: note: '__unary_function' declared here
[build] using __unary_function = __unary_function_keep_layout_base<_Arg, _Result>;
[build] ^
[build] 1 error generated.
[build] make[2]: *** [CMakeFiles/test_main.dir/028-Find-the-Index-of-the-First-Occurrence-in-a-String/solution_test.cpp.o] Error 1
[build] make[1]: *** [CMakeFiles/test_main.dir/all] Error 2
[build] make: *** [all] Error 2
[proc] The command: /usr/local/bin/cmake --build /Users/congliu/johnhany/leetcode/build --config Debug --target all -j 10 -- exited with code: 2
[driver] Build completed: 00:00:04.971
[build] Build finished with exit code 2
Solution
diff --git a/.gitignore b/.gitignore
index 97581c8..bc2c7ea 100644
--- a/.gitignore
+++ b/.gitignore
@@ -34,3 +34,4 @@
build/*
.vscode/settings.json
.vscode/ipch/*
+.DS_Store
diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json
index db42427..e2b1639 100644
--- a/.vscode/c_cpp_properties.json
+++ b/.vscode/c_cpp_properties.json
@@ -4,7 +4,7 @@
"name": "Mac",
"includePath": [
"${workspaceFolder}/**",
- "/usr/local/Cellar/boost/1.72.0_3/include"
+ "/usr/local/Cellar/boost/1.83.0/include"
],
"compilerPath": "/usr/bin/clang",
"cStandard": "c11",
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9d08cfe..a8fdea5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -25,8 +25,8 @@ if(WIN32)
target_link_libraries(test_main PRIVATE ${TEST_LIBS} Boost::boost Boost::unit_test_framework)
elseif(APPLE)
message(STATUS "Detected MacOS platform")
- set(BOOST_ROOT "/usr/local/Cellar/boost/1.72.0_3")
- set(BOOST_LIBRARYDIR "/usr/local/Cellar/boost/1.72.0_3/lib")
+ set(BOOST_ROOT "/usr/local/Cellar/boost/1.83.0")
+ set(BOOST_LIBRARYDIR "/usr/local/Cellar/boost/1.83.0/lib")
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost REQUIRED COMPONENTS unit_test_framework)
Metadata
Metadata
Assignees
Labels
No labels