You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
int main() {
// Display a formatted message
fmt::print("Hello, {fmt}!\n");
// Display current time using fmt
auto now = std::chrono::system_clock::now();
fmt::print("Current time: {:%Y-%m-%d %H:%M:%S}\n", now);
// End program
std::cout << "Program finished successfully!" << std::endl;
return 0;
cmake_minimum_required(VERSION 3.15)
Project Name
project(SplLogSample VERSION 1.0 LANGUAGES CXX)
Specify C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
Set default build type to Release
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
Find fmt library
find_package(fmt REQUIRED)
Include fmt as a target
add_executable(SplLog_Sample.bin main.cpp)
Link libraries
target_link_libraries(SplLog_Sample.bin PRIVATE fmt::fmt)
Enable warnings
target_compile_options(SplLog_Sample.bin PRIVATE -Wall -Wextra -Wpedantic -Werror)
Set libc++ for Clang
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
target_compile_options(SplLog_Sample.bin PRIVATE -stdlib=libc++)
target_link_options(SplLog_Sample.bin PRIVATE -stdlib=libc++ -lc++abi)
endif()
#include <fmt/core.h>
#include <fmt/chrono.h>
#include
#include
int main() {
// Display a formatted message
fmt::print("Hello, {fmt}!\n");
}
./SplLog_Sample.bin
rm -rf build
mkdir build
cd build
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -G Ninja ..
ninja
The text was updated successfully, but these errors were encountered: