tfussell / xlnt

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

Build with MinGW #80

Closed sukoi26 closed 8 years ago

sukoi26 commented 8 years ago

I try to compile the library under the environnement MinGW-64 unix pthread SEH g++ 6.2, win 7 x64 i use cmake -G "MinGW Makefiles" with no success. I believe a concern on libstudxml

1) in order to compile i undef win32 in workbook.cpp to avoid error (68%)


#undef WIN32
#ifdef WIN32
#include <codecvt> // utf-8 -> utf-16 conversion
#endif

[ 68%] Building CXX object source/CMakeFiles/xlnt.dir/workbook/workbook.cpp.obj In file included from D:/xlnt/third-party/libstudxml/xml/parser:467:0, from D:/xlnt/source/detail/include_libstudxml.hpp:30, from D:/xlnt/source/detail/xlsx_consumer.hpp:32, from D:\xlnt\source\workbook\workbook.cpp:42: D:/xlnt/third-party/libstudxml/xml/parser.ixx:213:15: warning: 'void xml::parser ::content(xml::parser::content_type)' redeclared without dllimport attribute aft er being referenced with dll linkage inline void parser:: ^~ D:/xlnt/third-party/libstudxml/xml/parser.ixx:235:39: warning: 'const xml::parse r::element_entry xml::parser::get_element() const' redeclared without dllimport attribute after being referenced with dll linkage inline const parser::element_entry parser:: ^~ D:\xlnt\source\workbook\workbook.cpp: In function 'std::__cxx11::wstring {anonym ous}::utf8_to_utf16(const string&)': D:\xlnt\source\workbook\workbook.cpp:71:5: error: 'wstring_convert' is not a mem ber of 'std' std::wstring_convert<std::codecvt_utf8> convert;

i compil with static it is OK some warning and lib libxlnt.a

D:\xlnt\third-party\libstudxml\xml\serializer.cxx:320:10: warning: 'size_t xml:serializer::indentation_suspended() const' redeclared without dllimport attribue: previous dllimport ignored [-Wattributes]
   size_t serializer::

but with samples flag

lot of Errors to link:

../lib/libxlnt.a(xlsx_producer.cpp.obj):xlsx_producer.cpp:(.text$_ZN3xml10serial izer10charactersIA1cEEvRKT[_ZN3xml10serializer10charactersIA1cEEvRKT]+0x40): undefined reference to __imp__ZN3xml10serializer10charactersERKNSt7__cxx1112ba sic_stringIcSt11char_traitsIcESaIcEEE' ../lib/libxlnt.a(xlsx_producer.cpp.obj):xlsx_producer.cpp:(.text$_ZN3xml10serial izer10charactersIA6_cEEvRKT_[_ZN3xml10serializer10charactersIA6_cEEvRKT_]+0x40): undefined reference toimpZN3xml10serializer10charactersERKNSt7cxx1112ba sic_stringIcSt11char_traitsIcESaIcEEE' ../lib/libxlnt.a(xlsx_producer.cpp.obj):xlsx_producer.cpp:(.text$ZN3xml10serial izer10charactersIjEEvRKT[ZN3xml10serializer10charactersIjEEvRKT]+0x38): undef ined reference to `impZN3xml10serializer10charactersERKNSt7cxx1112basic_st ringIcSt11char_traitsIcESaIcEEE' collect2.exe: error: ld returned 1 exit status make[2]: [samples\CMakeFiles\sample-decrypt.dir\build.make:98: bin/sample-de crypt.exe] Error 1 make[1]: [CMakeFiles\Makefile2:87: samples/CMakeFiles/sample-decrypt.dir/all ] Error 2 make: *** [Makefile:127: all] Error 2

d:\xlnt\build>

tfussell commented 8 years ago

Unfortunately, MinGW is a major configuration that I haven't taken the time to test/fix. I suspect it's caused by mixing up WIN32 macro which should be defined when compiling for Visual Studio and MinGW alike with MSVC macro which should only be defined for Visual Studio. I'll see if I can get that going in a few days.

sukoi26 commented 8 years ago

Many Thank, solded for me , After a short break, i continue to dvp my knowledge with your library 👍