tfussell / xlnt

:bar_chart: Cross-platform user-friendly xlsx library for C++11+
Other
1.43k stars 402 forks source link

Errors when try to use in Windows #727

Closed flaviu22 closed 4 months ago

flaviu22 commented 4 months ago

Win11, x64, compiled with vcpkg, tried to use it on a VS2022 console project (x64). I have the following code:

#include <iostream>
#include <xlnt/xlnt.hpp>

int main()
{
    std::cout << "Hello World!\n";

    return 0;
}

But I got:

1>------ Build started: Project: TestExcel1, Configuration: Debug x64 ------
1>TestExcel1.cpp
1>C:\Project\vcpkg\installed\x64-windows\include\xlnt\utils\exceptions.hpp(38,26): error C2011: 'xlnt::exception': 'class' type redefinition
1>C:\Project\TestExcel1\xlnt\utils\exceptions.hpp(38): message : see declaration of 'xlnt::exception'
1>C:\Project\vcpkg\installed\x64-windows\include\xlnt\utils\exceptions.hpp(73,34): error C2011: 'xlnt::invalid_parameter': 'class' type redefinition
1>C:\Project\TestExcel1\xlnt\utils\exceptions.hpp(73): message : see declaration of 'xlnt::invalid_parameter'
1>C:\Project\vcpkg\installed\x64-windows\include\xlnt\utils\exceptions.hpp(95,36): error C2011: 'xlnt::invalid_sheet_title': 'class' type redefinition
1>C:\Project\TestExcel1\xlnt\utils\exceptions.hpp(95): message : see declaration of 'xlnt::invalid_sheet_title'
1>C:\Project\vcpkg\installed\x64-windows\include\xlnt\utils\exceptions.hpp(117,38): error C2011: 'xlnt::missing_number_format': 'class' type redefinition
1>C:\Project\TestExcel1\xlnt\utils\exceptions.hpp(117): message : see declaration of 'xlnt::missing_number_format'
1>C:\Project\vcpkg\installed\x64-windows\include\xlnt\utils\exceptions.hpp(134,29): error C2011: 'xlnt::invalid_file': 'class' type redefinition
1>C:\Project\TestExcel1\xlnt\utils\exceptions.hpp(134): message : see declaration of 'xlnt::invalid_file'
1>C:\Project\vcpkg\installed\x64-windows\include\xlnt\utils\exceptions.hpp(158,34): error C2011: 'xlnt::illegal_character': 'class' type redefinition
1>C:\Project\TestExcel1\xlnt\utils\exceptions.hpp(158): message : see declaration of 'xlnt::illegal_character'
1>C:\Project\vcpkg\installed\x64-windows\include\xlnt\utils\exceptions.hpp(180,34): error C2011: 'xlnt::invalid_data_type': 'class' type redefinition
1>C:\Project\TestExcel1\xlnt\utils\exceptions.hpp(180): message : see declaration of 'xlnt::invalid_data_type'
1>C:\Project\vcpkg\installed\x64-windows\include\xlnt\utils\exceptions.hpp(202,37): error C2011: 'xlnt::invalid_column_index': 'class' type redefinition
1>C:\Project\TestExcel1\xlnt\utils\exceptions.hpp(202): message : see declaration of 'xlnt::invalid_column_index'
1>C:\Project\vcpkg\installed\x64-windows\include\xlnt\utils\exceptions.hpp(224,39): error C2011: 'xlnt::invalid_cell_reference': 'class' type redefinition
1>C:\Project\TestExcel1\xlnt\utils\exceptions.hpp(224): message : see declaration of 'xlnt::invalid_cell_reference'
1>C:\Project\vcpkg\installed\x64-windows\include\xlnt\utils\exceptions.hpp(251,34): error C2011: 'xlnt::invalid_attribute': 'class' type redefinition
1>C:\Project\TestExcel1\xlnt\utils\exceptions.hpp(251): message : see declaration of 'xlnt::invalid_attribute'
1>C:\Project\vcpkg\installed\x64-windows\include\xlnt\utils\exceptions.hpp(273,30): error C2011: 'xlnt::key_not_found': 'class' type redefinition
1>C:\Project\TestExcel1\xlnt\utils\exceptions.hpp(273): message : see declaration of 'xlnt::key_not_found'
1>C:\Project\vcpkg\installed\x64-windows\include\xlnt\utils\exceptions.hpp(295,38): error C2011: 'xlnt::no_visible_worksheets': 'class' type redefinition
1>C:\Project\TestExcel1\xlnt\utils\exceptions.hpp(295): message : see declaration of 'xlnt::no_visible_worksheets'
1>C:\Project\vcpkg\installed\x64-windows\include\xlnt\utils\exceptions.hpp(317,38): error C2011: 'xlnt::unhandled_switch_case': 'class' type redefinition
1>C:\Project\TestExcel1\xlnt\utils\exceptions.hpp(317): message : see declaration of 'xlnt::unhandled_switch_case'
1>C:\Project\vcpkg\installed\x64-windows\include\xlnt\utils\exceptions.hpp(339,28): error C2011: 'xlnt::unsupported': 'class' type redefinition
1>C:\Project\TestExcel1\xlnt\utils\exceptions.hpp(339): message : see declaration of 'xlnt::unsupported'
1>Done building project "TestExcel1.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Why? I noticed all those clases are inside xlnt namespace, but still there is a conflict, why?

image