我发现与CLion有关的pqxx的adjacent question。>
cmake_minimum_required(VERSION 3.15) project(pqxx_test) set(CMAKE_CXX_STANDARD 17) set(CMAKE_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_EXPORT_COMPILE_COMMANDS 1) if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake") message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan") file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/v0.15/conan.cmake" "${CMAKE_BINARY_DIR}/conan.cmake") endif() include(${CMAKE_BINARY_DIR}/conan.cmake) conan_cmake_run( REQUIRES libpqxx/7.0.1@bincrafters/stable boost/1.71.0@conan/stable OPTIONS *:shared=False *:fPIC=False BUILD missing GENERATORS cmake_find_package cmake) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) set(CMAKE_THREAD_PREFER_PTHREAD TRUE) set(THREADS_PREFER_PTHREAD_FLAG TRUE) find_package(Threads REQUIRED) add_executable(pqxx_test main.cpp) target_link_libraries(pqxx_test CONAN_PKG::libpqxx CONAN_PKG::boost Threads::Threads)
CLion报告
#include <pqxx/pqxx>
找不到它,因此用pqxx
命名空间的类声明的任何变量都以红色显示。
是否有办法让CLion索引标头?
P.S。该工具链是为远程构建而设置的。
我发现与CLion有关pqxx的另一个问题。 cmake_minimum_required(VERSION 3.15)项目(pqxx_test)设置(CMAKE_CXX_STANDARD 17)设置(CMAKE_STANDARD_REQUIRED ON)设置(CMAKE_CXX_EXTENSIONS ...
实际上,问题是,在远程开发中,如果您在cmake-build-debug
目录中有柯南生成的文件,则需要至少一次,如this blog中所述,通过调用Tools-> Resync with远程主机