1

我正在使用 QtHttpServer(来自 Qt6)编写服务器。是时候使用 Web 套接字为系统实现聊天了,但它还没有被添加到 Qt6 中。我看到了两种方法——要么使用长拉而不是 web sockets,要么从 qt5 下载 web sockets 代码并将其添加到项目中。我决定先尝试第二个选项,但我遇到了一个问题——该项目使用 QObjectPrivate。我知道它是 CorePrivate 库的一部分。我试图链接它,但它没有工作。你能告诉我这是否可以在 Qt6 中以某种方式解决吗?

制作:

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 会成功运行。

4

0 回答 0