Skip to content

VS2019 cpp_bindgen_generator compilation error #54

@WilcoBT

Description

@WilcoBT

Hallo,

I am trying this tool to generate a C interface for our C++ project. I followed the manual and added this to the makefile:

include(FetchContent)
FetchContent_Declare(
cpp_bindgen
GIT_REPOSITORY https://github.com/GridTools/cpp_bindgen.git
GIT_TAG master # consider replacing master by a tagged version
)
FetchContent_MakeAvailable(cpp_bindgen)
bindgen_add_library(${ADMESYTITANAPI_LIB_NAME}_C SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/titan/admesy_titan_api.cpp)

That results in a bunch of projects in VS, but I get a lot of errors when trying to build cpp_bindgen_generator:

Build started...
1>------ Build started: Project: cpp_bindgen_generator, Configuration: Debug x64 ------
1>generator.cpp
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\include\cpp_bindgen/generator.hpp(115,45): error C2789: 'value': an object of const-qualified type must be initialized
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\include\cpp_bindgen/generator.hpp(115): message : see declaration of 'value'
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\include\cpp_bindgen/generator.hpp(117,44): error C2789: 'value': an object of const-qualified type must be initialized
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\include\cpp_bindgen/generator.hpp(117): message : see declaration of 'value'
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\include\cpp_bindgen/generator.hpp(119,46): error C2789: 'value': an object of const-qualified type must be initialized
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\include\cpp_bindgen/generator.hpp(119): message : see declaration of 'value'
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\include\cpp_bindgen/generator.hpp(121,45): error C2789: 'value': an object of const-qualified type must be initialized
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\include\cpp_bindgen/generator.hpp(121): message : see declaration of 'value'
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\include\cpp_bindgen/generator.hpp(123,50): error C2789: 'value': an object of const-qualified type must be initialized
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\include\cpp_bindgen/generator.hpp(123): message : see declaration of 'value'
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\include\cpp_bindgen/generator.hpp(125,46): error C2789: 'value': an object of const-qualified type must be initialized
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\include\cpp_bindgen/generator.hpp(125): message : see declaration of 'value'
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\include\cpp_bindgen/generator.hpp(127,47): error C2789: 'value': an object of const-qualified type must be initialized
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\include\cpp_bindgen/generator.hpp(127): message : see declaration of 'value'
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\include\cpp_bindgen/generator.hpp(129,52): error C2789: 'value': an object of const-qualified type must be initialized
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\include\cpp_bindgen/generator.hpp(129): message : see declaration of 'value'
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\include\cpp_bindgen/generator.hpp(131,52): error C2789: 'value': an object of const-qualified type must be initialized
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\include\cpp_bindgen/generator.hpp(131): message : see declaration of 'value'
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\src\cpp_bindgen\generator.cpp(66,45): error C2086: 'const char cpp_bindgen::_impl::fortran_kind_name::value[]': redefinition
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\include\cpp_bindgen/generator.hpp(115): message : see declaration of 'value'
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\src\cpp_bindgen\generator.cpp(66,63): error C2086: 'const char cpp_bindgen::_impl::fortran_kind_name::value[]': redefinition
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\include\cpp_bindgen/generator.hpp(111): message : see declaration of 'cpp_bindgen::_impl::fortran_kind_name::value'
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\src\cpp_bindgen\generator.cpp(68,44): error C2086: 'const char cpp_bindgen::_impl::fortran_kind_name::value[]': redefinition
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\include\cpp_bindgen/generator.hpp(117): message : see declaration of 'value'
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\src\cpp_bindgen\generator.cpp(68,61): error C2086: 'const char cpp_bindgen::_impl::fortran_kind_name::value[]': redefinition
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\include\cpp_bindgen/generator.hpp(111): message : see declaration of 'cpp_bindgen::_impl::fortran_kind_name::value'
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\src\cpp_bindgen\generator.cpp(70,46): error C2086: 'const char cpp_bindgen::_impl::fortran_kind_name::value[]': redefinition
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\include\cpp_bindgen/generator.hpp(119): message : see declaration of 'value'
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\src\cpp_bindgen\generator.cpp(70,65): error C2086: 'const char cpp_bindgen::_impl::fortran_kind_name::value[]': redefinition
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\include\cpp_bindgen/generator.hpp(111): message : see declaration of 'cpp_bindgen::_impl::fortran_kind_name::value'
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\src\cpp_bindgen\generator.cpp(72,45): error C2086: 'const char cpp_bindgen::_impl::fortran_kind_name::value[]': redefinition
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\include\cpp_bindgen/generator.hpp(121): message : see declaration of 'value'
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\src\cpp_bindgen\generator.cpp(72,63): error C2086: 'const char cpp_bindgen::_impl::fortran_kind_name::value[]': redefinition
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\include\cpp_bindgen/generator.hpp(111): message : see declaration of 'cpp_bindgen::_impl::fortran_kind_name::value'
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\src\cpp_bindgen\generator.cpp(74,50): error C2086: 'const char cpp_bindgen::_impl::fortran_kind_name<__int64>::value[]': redefinition
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\include\cpp_bindgen/generator.hpp(123): message : see declaration of 'value'
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\src\cpp_bindgen\generator.cpp(74,73): error C2086: 'const char cpp_bindgen::_impl::fortran_kind_name<__int64>::value[]': redefinition
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\include\cpp_bindgen/generator.hpp(111): message : see declaration of 'cpp_bindgen::_impl::fortran_kind_name<__int64>::value'
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\src\cpp_bindgen\generator.cpp(76,46): error C2086: 'const char cpp_bindgen::_impl::fortran_kind_name::value[]': redefinition
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\include\cpp_bindgen/generator.hpp(125): message : see declaration of 'value'
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\src\cpp_bindgen\generator.cpp(76,65): error C2086: 'const char cpp_bindgen::_impl::fortran_kind_name::value[]': redefinition
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\include\cpp_bindgen/generator.hpp(111): message : see declaration of 'cpp_bindgen::_impl::fortran_kind_name::value'
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\src\cpp_bindgen\generator.cpp(78,47): error C2086: 'const char cpp_bindgen::_impl::fortran_kind_name::value[]': redefinition
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\include\cpp_bindgen/generator.hpp(127): message : see declaration of 'value'
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\src\cpp_bindgen\generator.cpp(78,67): error C2086: 'const char cpp_bindgen::_impl::fortran_kind_name::value[]': redefinition
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\include\cpp_bindgen/generator.hpp(111): message : see declaration of 'cpp_bindgen::_impl::fortran_kind_name::value'
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\src\cpp_bindgen\generator.cpp(80,52): error C2086: 'const char cpp_bindgen::_impl::fortran_kind_name::value[]': redefinition
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\include\cpp_bindgen/generator.hpp(129): message : see declaration of 'value'
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\src\cpp_bindgen\generator.cpp(80,77): error C2086: 'const char cpp_bindgen::_impl::fortran_kind_name::value[]': redefinition
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\include\cpp_bindgen/generator.hpp(111): message : see declaration of 'cpp_bindgen::_impl::fortran_kind_name::value'
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\src\cpp_bindgen\generator.cpp(82,52): error C2086: 'const char cpp_bindgen::_impl::fortran_kind_name::value[]': redefinition
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\include\cpp_bindgen/generator.hpp(131): message : see declaration of 'value'
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\src\cpp_bindgen\generator.cpp(82,77): error C2086: 'const char cpp_bindgen::_impl::fortran_kind_name::value[]': redefinition
1>C:\source\admesy-atlas-api\build2_deps\cpp_bindgen-src\include\cpp_bindgen/generator.hpp(111): message : see declaration of 'cpp_bindgen::_impl::fortran_kind_name::value'
1>Done building project "cpp_bindgen_generator.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========

How can i get rid of this such that I can try the generating?

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