Skip to content

Compile error in format-inl.h when including FMT using CMake's FetchContent on Windows 聽#2808

Description

@szymonj99

I'm using CMake and using GitHub Actions to compile the code remotely. I'm getting the same compile error locally.

Using this commit: a8fe8be

I like to think the options below might be of use (e.g. The C++ standard I'm using.) 馃殌

CMakeLists.txt

...
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
add_subdirectory(src)

src/CMakeLists.txt

...
FetchContent_Declare(fmt
  GIT_REPOSITORY https://github.com/fmtlib/fmt.git
  GIT_TAG a8fe8becf45b520c03250bda6e6914786ee91d83
)
FetchContent_MakeAvailable(... fmt ...)
...
set(BUILD_SHARED_LIBS OFF)
...
set(SPDLOG_FMT_EXTERNAL_HO ON)
set(SPDLOG_FMT_EXTERNAL OFF)
...
target_link_libraries(${PROJECT_NAME} PRIVATE ... fmt::fmt-header-only ...)
...
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20)
...

Error log

...\build\_deps\fmt-src\include\fmt\format-inl.h(1823,44): warning C4003: not enough arguments for function-like macro invocation 'max'
...\build\_deps\fmt-src\include\fmt\format-inl.h(1823,44): error C2589: '(': illegal token on right side of '::'
...\build\_deps\fmt-src\include\fmt\format-inl.h(1823): error C2062: type 'unknown-type' unexpected
...\build\_deps\fmt-src\include\fmt\format-inl.h(1823,55): error C2059: syntax error: ')'
...\build\_deps\fmt-src\include\fmt\format-inl.h(1828,43): warning C4003: not enough arguments for function-like macro invocation 'max'
...\build\_deps\fmt-src\include\fmt\format-inl.h(1828,43): error C2589: '(': illegal token on right side of '::'
...\build\_deps\fmt-src\include\fmt\format-inl.h(1828): error C2062: type 'unknown-type' unexpected
...\build\_deps\fmt-src\include\fmt\format-inl.h(1828,53): error C2059: syntax error: ')'
...\build\_deps\fmt-src\include\fmt\format-inl.h(1828,55): error C2143: syntax error: missing ';' before '{'
...\build\_deps\fmt-src\include\fmt\format-inl.h(1855,46): warning C4003: not enough arguments for function-like macro invocation 'max'
...\build\_deps\fmt-src\include\fmt\format-inl.h(1855,46): error C2589: '(': illegal token on right side of '::'
...\build\_deps\fmt-src\include\fmt\format-inl.h(1855): error C2062: type 'unknown-type' unexpected
...\build\_deps\fmt-src\include\fmt\format-inl.h(1855,57): error C2059: syntax error: ')'
...\build\_deps\fmt-src\include\fmt\format-inl.h(1860,45): warning C4003: not enough arguments for function-like macro invocation 'max'
...\build\_deps\fmt-src\include\fmt\format-inl.h(1860,45): error C2589: '(': illegal token on right side of '::'
...\build\_deps\fmt-src\include\fmt\format-inl.h(1860): error C2062: type 'unknown-type' unexpected
...\build\_deps\fmt-src\include\fmt\format-inl.h(1860,55): error C2059: syntax error: ')'
...\build\_deps\fmt-src\include\fmt\format-inl.h(1860,57): error C2143: syntax error: missing ';' before '{'
...\build\_deps\fmt-src\include\fmt\format-inl.h(1876,44): warning C4003: not enough arguments for function-like macro invocation 'max'
...\build\_deps\fmt-src\include\fmt\format-inl.h(1876,44): error C2589: '(': illegal token on right side of '::'
...\build\_deps\fmt-src\include\fmt\format-inl.h(1876): error C2062: type 'unknown-type' unexpected
...\build\_deps\fmt-src\include\fmt\format-inl.h(1876,55): error C2059: syntax error: ')'
...\build\_deps\fmt-src\include\fmt\format-inl.h(1881,43): warning C4003: not enough arguments for function-like macro invocation 'max'
...\build\_deps\fmt-src\include\fmt\format-inl.h(1881,43): error C2589: '(': illegal token on right side of '::'
...\build\_deps\fmt-src\include\fmt\format-inl.h(1881): error C2062: type 'unknown-type' unexpected
...\build\_deps\fmt-src\include\fmt\format-inl.h(1881,53): error C2059: syntax error: ')'
...\build\_deps\fmt-src\include\fmt\format-inl.h(1881,55): error C2143: syntax error: missing ';' before '{'

I wonder if this is a configuration issue instead, or something to do with me including additional dependencies 馃

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions