I have the project github SageStore, branch 64_create_mainwindow
I'm trying to configure project on my Windows 11 machine using VS Code as an IDE.
So, when I'm building my project I'm like
conan install . --output-folder=build --build=missing -s build_type=Debug
cmake .. --preset conan-debug
cmake --build .
And then I just go and run the bad guy:
cd build\Client
.\SageStoreClient.exe
But unless the main.cpp where I do something like this:
void initSpdlog()
{
// Create color multi threaded logger
auto console = spdlog::stdout_color_mt("console");
// Set the log level
console->set_level(spdlog::level::info);
// Set the pattern
console->set_pattern("[%Y-%m-%d %H:%M:%S.%e] [%^%l%$] %v");
// Flush the log entries automatically
console->flush_on(spdlog::level::info);
}
int main()
{
std::cout << "stdout works fine" << std::endl;
initSpdlog();
SPDLOG_INFO("SageStoreClient started"); // Make sure you're using the macro SPDLOG_INFO, not the function
}
The program prints nothing.
When I use Qt Creator to setup project and run it. It gives me fine output for stdout inside Qt Creator (no matter if it's output window or external terminal).
I figured out that it's because Projects >> Run >> Add build library search in PATH
flag
Or <value type="bool" key="RunConfiguration.UseLibrarySearchPath">false</value>
inside the CMakeLists.txt.user generated by Qt Creator on the project configuration stage.
I've created small conan&cmake app just to test stdout (using std::cout) and spdlog lib from conan. Everything is fine.
I think that something is wrong with my environment variables. Especially, in env I guess I have no paths to installed conan2 shared libs for proper execution.
Does conan2 provide proper solution for this? My research still gives nothing.
Also I expect some Qt 6.4.3 stdout CMake C++20 conflicts.
The main problem was that Conan2 generate shared libs that I don't have path to and bat scripts to setup env conanrun.bat
for running also does not help. For example, in windows this libs should be in PATH
to be found (or LD_LIBRARY_PATH
for linux).
So, I just configured conan to copy shared libs and it's deps direct to my executables and, as expected, it fixed the issue.