Skip to content
  • 0 Votes
    16 Posts
    2k Views
    S
    @cristian-adam Thanks no everything is working. <3 Really appreciate that you took the time. I'll mark this post as solved for others who may come across this post. So my learnings are: Solution/Learnings -Conan 2.0 + Qt Creator . You don't need the conan plugin for Qt Creator --> as for now March 2025; QT Version 6.9, Creator Version 16.0.0 conanfile 2.0 support for .txt and .py is build in Enable packagemanager auto setup in the cmake settings of your qt creator project If everything works fine you don't have to enter any conan command manual For anyone to copy and paste here the small demofiles for spdlog: conanfile.py: from conan import ConanFile from conan.tools.cmake import cmake_layout class ExampleRecipe(ConanFile): settings = "os", "compiler", "build_type", "arch" generators = "CMakeDeps", "CMakeToolchain" def requirements(self): self.requires("spdlog/1.15.1") def layout(self): cmake_layout(self) main.cpp: #include <iostream> #include <spdlog/spdlog.h> #include <spdlog/sinks/basic_file_sink.h> #include <spdlog/sinks/rotating_file_sink.h> #include <memory> int main() { try { // Einfacher Konsolen-Logger spdlog::info("Welcome to spdlog!"); spdlog::warn("This is a warning!"); spdlog::error("This is an error message!"); spdlog::debug("This debug message won't show unless you change the log level."); // Log-Level auf debug setzen spdlog::set_level(spdlog::level::debug); spdlog::debug("Now debug messages are visible!"); // Logger, der in eine Datei schreibt auto file_logger = spdlog::basic_logger_mt("file_logger", "logs/basic_log.txt"); file_logger->info("Logging to basic file."); file_logger->warn("Some warning in file log."); // Rotating file logger (max 5 MB pro Datei, max 3 Dateien) auto rotating_logger = spdlog::rotating_logger_mt("rot_logger", "logs/rotating_log.txt", 1048576 * 5, 3); rotating_logger->info("This is a rotating logger."); rotating_logger->error("Something went wrong in rotating logger."); // Log-Pattern ändern spdlog::set_pattern("[%Y-%m-%d %H:%M:%S.%e] %v [%l]"); spdlog::info("Using custom log pattern now."); // Flushing spdlog::flush_on(spdlog::level::info); } catch (const spdlog::spdlog_ex& ex) { std::cerr << "Log initialization failed: " << ex.what() << std::endl; return 1; } } CMakeLists.cpp: cmake_minimum_required(VERSION 3.24) set(CMAKE_CXX_STANDARD 20) project(spdlogexample) find_package(spdlog REQUIRED) add_executable(spdlogexample main.cpp) target_link_libraries(spdlogexample PRIVATE spdlog::spdlog) install(TARGETS spdlogexample)