我正在使用QtHttpServer (来自Qt6)编写一个服务器。现在是使用web套接字实现系统聊天的时候了,但它还没有添加到Qt6中。我看到了两种解决方案--要么使用长拉代替web套接字,要么从qt5下载web套接字代码并将其添加到项目中。我决定先尝试第二个选项,但遇到了一个问题--该项目使用QObjectPrivate。我知道它是CorePrivate库的一部分。我试着把它联系起来,但没成功。你能告诉我这件事能否在Qt6中得到解决吗?
cmake:
find_package(Qt6 COMPONENTS CorePrivate Core Network Sql HttpServer REQUIRED)
...
add_executable(${PROJECT_NAME} ${HEADERS} ${SOURCES})
target_link_libraries(${PROJECT_NAME} Qt6::CorePrivate Qt6::Core Qt6::Network Qt6::Sql Qt6::HttpServer)错误:
CMake Error at CMakeLists.txt:12 (find_package):
Found package configuration file:
/usr/local/opt/qt/lib/cmake/Qt6/Qt6Config.cmake
but it set Qt6_FOUND to FALSE so package "Qt6" is considered to be NOT
FOUND. Reason given by package:
Failed to find Qt component "CorePrivate" config file at ""
Failed to find Qt component "Core" config file at ""
Failed to find Qt component "Network" config file at ""
Failed to find Qt component "Sql" config file at ""
Failed to find Qt component "HttpServer" config file at ""在没有CorePrivate的情况下,cmake成功运行。
发布于 2022-05-23 09:15:36
CorePrivate似乎是核心组件的一部分,所以不需要将它添加到find_package中。
您所需要做的就是在Qt6::CorePrivate中调用target_link_libraries。
https://stackoverflow.com/questions/67009484
复制相似问题