GridTools / cpp_bindgen

Library for generating C and Fortran bindings for C++ functions from C++
Other
15 stars 4 forks source link

VS2019 cpp_bindgen_generator compilation error #54

Open WilcoBT opened 3 years ago

WilcoBT commented 3 years ago

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?

havogt commented 2 years ago

Hi @WilcoBT, I am very sorry, I completely missed this issue. Unfortunately, this library currently doesn't support visual studio. I also don't have the environment to reproduce it. However we would happily take contributions to make this library compatible with visual studio.

lumiamax commented 12 months ago

hello @WilcoBT It seems that you are currently working on software related to the Admesy Atlas. I'm also deeply interested in this. Unfortunately, I can no longer find the relevant drivers and the official GUI for this device. I was wondering if you happen to have the software I'm seeking? I would greatly appreciate your assistance. If necessary, I'm willing to provide compensation for your help. Please contact me at lumiamax@live.cn.