我正在我的MacBook M2 Max,MacOS 13.5 Ventura上构建QCefView。
以下是我的CMakeLists.txt:
cmake_minimum_required(VERSION 3.5)
project(CEFTest VERSION 0.1 LANGUAGES CXX)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
add_subdirectory(QCefView)
set(PROJECT_SOURCES
main.cpp
mainwindow.cpp
mainwindow.h
mainwindow.ui
)
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_executable(CEFTest
MANUAL_FINALIZATION
${PROJECT_SOURCES}
)
# Define target properties for Android with Qt 6 as:
# set_property(TARGET CEFTest APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
# ${CMAKE_CURRENT_SOURCE_DIR}/android)
# For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation
else()
if(ANDROID)
add_library(CEFTest SHARED
${PROJECT_SOURCES}
)
# Define properties for Android with Qt 5 after find_package() calls as:
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
else()
add_executable(CEFTest
${PROJECT_SOURCES}
)
endif()
endif()
target_link_libraries(CEFTest PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
# If you are developing for iOS or macOS you should consider setting an
# explicit, fixed bundle identifier manually though.
if(${QT_VERSION} VERSION_LESS 6.1.0)
set(BUNDLE_ID_OPTION MACOSX_BUNDLE_GUI_IDENTIFIER com.example.CEFTest)
endif()
set_target_properties(CEFTest PROPERTIES
${BUNDLE_ID_OPTION}
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
MACOSX_BUNDLE TRUE
WIN32_EXECUTABLE TRUE
)
include(GNUInstallDirs)
install(TARGETS CEFTest
BUNDLE DESTINATION .
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
if(QT_VERSION_MAJOR EQUAL 6)
qt_finalize_executable(CEFTest)
endif()
字符串
在构建时,我得到了这个错误:
[ 95%] Building CXX object QCefView/src/CMakeFiles/QCefView.dir/details/QCefConfigPrivate.cpp.o
In file included from /Users/venelin/Development/CEFTest/CEFTest/QCefView/src/details/QCefConfigPrivate.cpp:5:
In file included from /Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/QDir:1:
In file included from /Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/qdir.h:8:
/Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/qfile.h:59:58: error: 'path' is unavailable: introduced in macOS 10.15
inline QString fromFilesystemPath(const std::filesystem::path &path)
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/c++/v1/filesystem:909:24: note: 'path' has been explicitly marked unavailable here
class _LIBCPP_TYPE_VIS path {
^
In file included from /Users/venelin/Development/CEFTest/CEFTest/QCefView/src/details/QCefConfigPrivate.cpp:5:
In file included from /Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/QDir:1:
In file included from /Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/qdir.h:8:
/Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/qfile.h:64:40: error: 'native' is unavailable: introduced in macOS 10.15
return QString::fromStdString(path.native());
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/c++/v1/filesystem:1193:22: note: 'native' has been explicitly marked unavailable here
const string_type& native() const noexcept { return __pn_; }
^
In file included from /Users/venelin/Development/CEFTest/CEFTest/QCefView/src/details/QCefConfigPrivate.cpp:5:
In file included from /Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/QDir:1:
In file included from /Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/qdir.h:8:
/Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/qfile.h:68:25: error: 'path' is unavailable: introduced in macOS 10.15
inline std::filesystem::path toFilesystemPath(const QString &path)
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/c++/v1/filesystem:909:24: note: 'path' has been explicitly marked unavailable here
class _LIBCPP_TYPE_VIS path {
^
In file included from /Users/venelin/Development/CEFTest/CEFTest/QCefView/src/details/QCefConfigPrivate.cpp:5:
In file included from /Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/QDir:1:
In file included from /Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/qdir.h:8:
/Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/qfile.h:70:29: error: 'path' is unavailable: introduced in macOS 10.15
return std::filesystem::path(reinterpret_cast<const char16_t *>(path.cbegin()),
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/c++/v1/filesystem:909:24: note: 'path' has been explicitly marked unavailable here
class _LIBCPP_TYPE_VIS path {
^
In file included from /Users/venelin/Development/CEFTest/CEFTest/QCefView/src/details/QCefConfigPrivate.cpp:5:
In file included from /Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/QDir:1:
In file included from /Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/qdir.h:8:
/Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/qfile.h:70:12: error: 'path<const char16_t *>' is unavailable: introduced in macOS 10.15
return std::filesystem::path(reinterpret_cast<const char16_t *>(path.cbegin()),
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/c++/v1/filesystem:953:3: note: 'path<const char16_t *>' has been explicitly marked unavailable here
path(_InputIt __first, _InputIt __last, format = format::auto_format) {
^
In file included from /Users/venelin/Development/CEFTest/CEFTest/QCefView/src/details/QCefConfigPrivate.cpp:5:
In file included from /Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/QDir:1:
In file included from /Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/qdir.h:8:
/Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/qfile.h:70:12: error: 'path' is unavailable: introduced in macOS 10.15
return std::filesystem::path(reinterpret_cast<const char16_t *>(path.cbegin()),
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/c++/v1/filesystem:953:3: note: 'path' has been explicitly marked unavailable here
path(_InputIt __first, _InputIt __last, format = format::auto_format) {
^
In file included from /Users/venelin/Development/CEFTest/CEFTest/QCefView/src/details/QCefConfigPrivate.cpp:5:
In file included from /Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/QDir:1:
In file included from /Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/qdir.h:8:
/Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/qfile.h:70:12: error: '~path' is unavailable: introduced in macOS 10.15
return std::filesystem::path(reinterpret_cast<const char16_t *>(path.cbegin()),
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/c++/v1/filesystem:968:3: note: '~path' has been explicitly marked unavailable here
~path() = default;
^
In file included from /Users/venelin/Development/CEFTest/CEFTest/QCefView/src/details/QCefConfigPrivate.cpp:5:
In file included from /Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/QDir:1:
In file included from /Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/qdir.h:8:
/Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/qfile.h:128:22: error: 'path' is unavailable: introduced in macOS 10.15
std::filesystem::path filesystemFileName() const
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/c++/v1/filesystem:909:24: note: 'path' has been explicitly marked unavailable here
class _LIBCPP_TYPE_VIS path {
^
In file included from /Users/venelin/Development/CEFTest/CEFTest/QCefView/src/details/QCefConfigPrivate.cpp:5:
In file included from /Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/QDir:1:
In file included from /Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/qdir.h:8:
/Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/qfile.h:190:22: error: 'path' is unavailable: introduced in macOS 10.15
std::filesystem::path filesystemSymLinkTarget() const
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/c++/v1/filesystem:909:24: note: 'path' has been explicitly marked unavailable here
class _LIBCPP_TYPE_VIS path {
^
In file included from /Users/venelin/Development/CEFTest/CEFTest/QCefView/src/details/QCefConfigPrivate.cpp:5:
In file included from /Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/QDir:1:
In file included from /Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/qdir.h:8:
/Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/qfile.h:195:29: error: 'path' is unavailable: introduced in macOS 10.15
static std::filesystem::path filesystemSymLinkTarget(const T &fileName)
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/c++/v1/filesystem:909:24: note: 'path' has been explicitly marked unavailable here
class _LIBCPP_TYPE_VIS path {
^
In file included from /Users/venelin/Development/CEFTest/CEFTest/QCefView/src/details/QCefConfigPrivate.cpp:5:
In file included from /Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/QDir:1:
In file included from /Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/qdir.h:8:
/Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/qfile.h:129:14: error: '~path' is unavailable: introduced in macOS 10.15
{ return QtPrivate::toFilesystemPath(fileName()); }
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/c++/v1/filesystem:968:3: note: '~path' has been explicitly marked unavailable here
~path() = default;
^
In file included from /Users/venelin/Development/CEFTest/CEFTest/QCefView/src/details/QCefConfigPrivate.cpp:5:
In file included from /Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/QDir:1:
In file included from /Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/qdir.h:8:
/Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/qfile.h:192:16: error: '~path' is unavailable: introduced in macOS 10.15
return QtPrivate::toFilesystemPath(symLinkTarget());
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/c++/v1/filesystem:968:3: note: '~path' has been explicitly marked unavailable here
~path() = default;
^
In file included from /Users/venelin/Development/CEFTest/CEFTest/QCefView/src/details/QCefConfigPrivate.cpp:5:
In file included from /Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/QDir:1:
In file included from /Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/qdir.h:9:
/Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/qfileinfo.h:82:22: error: 'path' is unavailable: introduced in macOS 10.15
std::filesystem::path filesystemFilePath() const
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/c++/v1/filesystem:909:24: note: 'path' has been explicitly marked unavailable here
class _LIBCPP_TYPE_VIS path {
^
In file included from /Users/venelin/Development/CEFTest/CEFTest/QCefView/src/details/QCefConfigPrivate.cpp:5:
In file included from /Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/QDir:1:
In file included from /Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/qdir.h:9:
/Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/qfileinfo.h:84:22: error: 'path' is unavailable: introduced in macOS 10.15
std::filesystem::path filesystemAbsoluteFilePath() const
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/c++/v1/filesystem:909:24: note: 'path' has been explicitly marked unavailable here
class _LIBCPP_TYPE_VIS path {
^
In file included from /Users/venelin/Development/CEFTest/CEFTest/QCefView/src/details/QCefConfigPrivate.cpp:5:
In file included from /Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/QDir:1:
In file included from /Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/qdir.h:9:
/Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/qfileinfo.h:86:22: error: 'path' is unavailable: introduced in macOS 10.15
std::filesystem::path filesystemCanonicalFilePath() const
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/c++/v1/filesystem:909:24: note: 'path' has been explicitly marked unavailable here
class _LIBCPP_TYPE_VIS path {
^
In file included from /Users/venelin/Development/CEFTest/CEFTest/QCefView/src/details/QCefConfigPrivate.cpp:5:
In file included from /Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/QDir:1:
In file included from /Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/qdir.h:9:
/Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/qfileinfo.h:100:22: error: 'path' is unavailable: introduced in macOS 10.15
std::filesystem::path filesystemPath() const { return QtPrivate::toFilesystemPath(path()); }
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/c++/v1/filesystem:909:24: note: 'path' has been explicitly marked unavailable here
class _LIBCPP_TYPE_VIS path {
^
In file included from /Users/venelin/Development/CEFTest/CEFTest/QCefView/src/details/QCefConfigPrivate.cpp:5:
In file included from /Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/QDir:1:
In file included from /Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/qdir.h:9:
/Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/qfileinfo.h:101:22: error: 'path' is unavailable: introduced in macOS 10.15
std::filesystem::path filesystemAbsolutePath() const
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/c++/v1/filesystem:909:24: note: 'path' has been explicitly marked unavailable here
class _LIBCPP_TYPE_VIS path {
^
In file included from /Users/venelin/Development/CEFTest/CEFTest/QCefView/src/details/QCefConfigPrivate.cpp:5:
In file included from /Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/QDir:1:
In file included from /Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/qdir.h:9:
/Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/qfileinfo.h:103:22: error: 'path' is unavailable: introduced in macOS 10.15
std::filesystem::path filesystemCanonicalPath() const
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/c++/v1/filesystem:909:24: note: 'path' has been explicitly marked unavailable here
class _LIBCPP_TYPE_VIS path {
^
In file included from /Users/venelin/Development/CEFTest/CEFTest/QCefView/src/details/QCefConfigPrivate.cpp:5:
In file included from /Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/QDir:1:
In file included from /Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/qdir.h:9:
/Users/venelin/Qt/6.6.0/macos/lib/QtCore.framework/Headers/qfileinfo.h:134:22: error: 'path' is unavailable: introduced in macOS 10.15
std::filesystem::path filesystemSymLinkTarget() const
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/c++/v1/filesystem:909:24: note: 'path' has been explicitly marked unavailable here
class _LIBCPP_TYPE_VIS path {
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [QCefView/src/CMakeFiles/QCefView.dir/details/QCefConfigPrivate.cpp.o] Error 1
make[1]: *** [QCefView/src/CMakeFiles/QCefView.dir/all] Error 2
make: *** [all] Error 2
☁ build
型
任何想法为什么我得到这个错误,我如何修复它?
已经试过了:cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 ..
,但似乎没有什么变化。
1条答案
按热度按时间m3eecexj1#
1.对于Qt版本< 6.5,Qt不使用std::filesystem::path,因此它可以支持macOS版本10.15以下
1.从6.5开始,Qt仅支持macOS 11+,Qt使用std::filesystem::path
但是QCefView仍然需要支持macOS 10.13+,如果你想用Qt 6.5+编译QCefView,这意味着最低部署目标应该是macOS 11.0+。
请参阅:https://github.com/CefView/QCefView/issues/341