szhorvat / LTemplate

Extend Mathematica with LibraryLink and C++ with ease
57 stars 10 forks source link

LTemplate cannot use MinGW64 to compile code #10

Closed lavender-lee closed 1 year ago

lavender-lee commented 4 years ago

screenshot

Setup compiler as MinGW64 as follows:

Needs["CCompilerDriver`GenericCCompiler`"]

$CCompiler = {"Compiler" -> GenericCCompiler, 
   "CompilerInstallation" -> "D:/Win10/mingw64", 
   "CompilerName" -> "x86_64-w64-mingw32-gcc.exe"};

c = Compile[ {x}, x^2 + Sin[x^2], CompilationTarget -> "C"]
(*it works well*)

However, when I compile the code in tutorial of LTemplate, it gives the error collect2.exe: error: ld returned 1 exit status

CompileTemplate[template, "CompileOptions" -> "-lstdc++", "ShellCommandFunction" -> Print, "ShellOutputFunction" -> Print]

Current directory is: C:\Users\xxx\AppData\Local\Temp

Unloading library DemoLib ...

Generating library code ...

LTemplate-DemoLib.cpp already exists and will be overwritten.

Compiling library code ...

D:\Win10\mingw64\bin\x86_64-w64-mingw32-gcc.exe -shared -o "C:\Users\xxx\AppData\Roaming\Mathematica\SystemFiles\LibraryResources\Windows-x86-64\Working-desktop-2jes2lv-3420-2684-12\DemoLib.dll" -std=c++11 -lstdc++  -I"D:\Win10\Wolfram Research\Mathematica\10.4\SystemFiles\IncludeFiles\C" -I"D:\Win10\Wolfram Research\Mathematica\10.4\SystemFiles\Links\MathLink\DeveloperKit\Windows-x86-64\CompilerAdditions\mldev64\include" -I"C:\Users\xxx\AppData\Roaming\Mathematica\Applications\LTemplate\IncludeFiles" "C:\Users\xxx\AppData\Local\Temp\LTemplate-DemoLib.cpp"  -L"D:\Win10\Wolfram Research\Mathematica\10.4\SystemFiles\Links\MathLink\DeveloperKit\Windows-x86-64\CompilerAdditions\mldev64\lib" -L"D:\Win10\Wolfram Research\Mathematica\10.4\SystemFiles\Libraries\Windows-x86-64"   2>&1

C:\Users\xxx\AppData\Roaming\Mathematica\SystemFiles\LibraryResources\Windows-x86-64\Working-desktop-2jes2lv-3420-2684-12>D:\Win10\mingw64\bin\x86_64-w64-mingw32-gcc.exe -shared -o "C:\Users\xxx\AppData\Roaming\Mathematica\SystemFiles\LibraryResources\Windows-x86-64\Working-desktop-2jes2lv-3420-2684-12\DemoLib.dll" -std=c++11 -lstdc++  -I"D:\Win10\Wolfram Research\Mathematica\10.4\SystemFiles\IncludeFiles\C" -I"D:\Win10\Wolfram Research\Mathematica\10.4\SystemFiles\Links\MathLink\DeveloperKit\Windows-x86-64\CompilerAdditions\mldev64\include" -I"C:\Users\xxx\AppData\Roaming\Mathematica\Applications\LTemplate\IncludeFiles" "C:\Users\xxx\AppData\Local\Temp\LTemplate-DemoLib.cpp"  -L"D:\Win10\Wolfram Research\Mathematica\10.4\SystemFiles\Links\MathLink\DeveloperKit\Windows-x86-64\CompilerAdditions\mldev64\lib" -L"D:\Win10\Wolfram Research\Mathematica\10.4\SystemFiles\Libraries\Windows-x86-64"    2>&1 
In file included from C:\Users\xxx\AppData\Local\Temp\LTemplate-DemoLib.cpp:6:
C:\Users\xxx\AppData\Roaming\Mathematica\Applications\LTemplate\IncludeFiles/LTemplate.h: In function 'mint mma::detail::libraryType()':
C:\Users\xxx\AppData\Roaming\Mathematica\Applications\LTemplate\IncludeFiles/LTemplate.h:280:5: warning: no return statement in function returning non-void [-Wreturn-type]
     }
     ^
C:\Users\xxx\AppData\Roaming\Mathematica\Applications\LTemplate\IncludeFiles/LTemplate.h: In function 'rawarray_t mma::detail::libraryRawType()':
C:\Users\xxx\AppData\Roaming\Mathematica\Applications\LTemplate\IncludeFiles/LTemplate.h:1048:5: warning: no return statement in function returning non-void [-Wreturn-type]
     }
     ^
C:\Users\xxx\AppData\Roaming\Mathematica\Applications\LTemplate\IncludeFiles/LTemplate.h: In function 'imagedata_t mma::detail::libraryImageType()':
C:\Users\xxx\AppData\Roaming\Mathematica\Applications\LTemplate\IncludeFiles/LTemplate.h:1585:5: warning: no return statement in function returning non-void [-Wreturn-type]
     }
     ^
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x1a): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::pptr() const'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x29): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::pbase() const'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x3a): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::pptr() const'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x66): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::pbump(int)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x72): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::pptr() const'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x81): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::pptr() const'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x90): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::pbase() const'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0xcb): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::pbump(int)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x10c): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::pptr() const'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x11b): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::epptr() const'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x145): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::pptr() const'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x162): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::pptr() const'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x171): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::pbase() const'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x1e3): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::setp(char*, char*)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x1f6): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::pbump(int)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x2b6): undefined reference to `MLPutFunction'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x2cf): undefined reference to `MLPutFunction'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x2e8): undefined reference to `MLPutFunction'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x2fb): undefined reference to `MLPutSymbol'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x30b): undefined reference to `MLPutString'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x31b): undefined reference to `MLPutString'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x33e): undefined reference to `MLNextPacket'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x353): undefined reference to `MLNewPacket'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x390): undefined reference to `operator new(unsigned long long)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x41d): undefined reference to `operator delete(void*)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x602): undefined reference to `__cxa_begin_catch'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x626): undefined reference to `__cxa_end_catch'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x630): undefined reference to `__cxa_begin_catch'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x664): undefined reference to `__cxa_end_catch'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x671): undefined reference to `__cxa_begin_catch'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x68c): undefined reference to `__cxa_end_catch'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x699): undefined reference to `__cxa_end_catch'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x6a3): undefined reference to `__cxa_end_catch'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x6ad): undefined reference to `__cxa_end_catch'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x81e): undefined reference to `__cxa_begin_catch'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x842): undefined reference to `__cxa_end_catch'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x84c): undefined reference to `__cxa_begin_catch'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x880): undefined reference to `__cxa_end_catch'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x88d): undefined reference to `__cxa_begin_catch'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x8a8): undefined reference to `__cxa_end_catch'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x8b5): undefined reference to `__cxa_end_catch'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x8bf): undefined reference to `__cxa_end_catch'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x8c9): undefined reference to `__cxa_end_catch'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x91e): undefined reference to `std::basic_ostream<char, std::char_traits<char> >::~basic_ostream()'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text+0x98d): undefined reference to `std::basic_ostream<char, std::char_traits<char> >::basic_ostream(std::basic_streambuf<char, std::char_traits<char> >*)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma7messageERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_11MessageTypeE[_ZN3mma7messageERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_11MessageTypeE]+0x14): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::c_str() const'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma5printEPKc[_ZN3mma5printEPKc]+0x5d): undefined reference to `MLPutFunction'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma5printEPKc[_ZN3mma5printEPKc]+0x76): undefined reference to `MLPutFunction'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma5printEPKc[_ZN3mma5printEPKc]+0x86): undefined reference to `MLPutString'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma5printEPKc[_ZN3mma5printEPKc]+0xa9): undefined reference to `MLNextPacket'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma5printEPKc[_ZN3mma5printEPKc]+0xbe): undefined reference to `MLNewPacket'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma12LibraryErrorC1Ei[_ZN3mma12LibraryErrorC1Ei]+0x17): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string()'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma12LibraryErrorC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi[_ZN3mma12LibraryErrorC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi]+0x20): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma12LibraryErrorD1Ev[_ZN3mma12LibraryErrorD1Ev]+0x14): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma6detail12massert_implEPKcS2_i[_ZN3mma6detail12massert_implEPKcS2_i]+0x33): undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream(std::_Ios_Openmode)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma6detail12massert_implEPKcS2_i[_ZN3mma6detail12massert_implEPKcS2_i]+0x46): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma6detail12massert_implEPKcS2_i[_ZN3mma6detail12massert_implEPKcS2_i]+0x55): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma6detail12massert_implEPKcS2_i[_ZN3mma6detail12massert_implEPKcS2_i]+0x67): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma6detail12massert_implEPKcS2_i[_ZN3mma6detail12massert_implEPKcS2_i]+0x76): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma6detail12massert_implEPKcS2_i[_ZN3mma6detail12massert_implEPKcS2_i]+0x86): undefined reference to `std::ostream::operator<<(int)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma6detail12massert_implEPKcS2_i[_ZN3mma6detail12massert_implEPKcS2_i]+0x99): undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::str() const'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma6detail12massert_implEPKcS2_i[_ZN3mma6detail12massert_implEPKcS2_i]+0xbc): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma6detail12massert_implEPKcS2_i[_ZN3mma6detail12massert_implEPKcS2_i]+0xc6): undefined reference to `__cxa_allocate_exception'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma6detail12massert_implEPKcS2_i[_ZN3mma6detail12massert_implEPKcS2_i]+0xef): undefined reference to `__cxa_throw'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma6detail12massert_implEPKcS2_i[_ZN3mma6detail12massert_implEPKcS2_i]+0x101): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma6detail12massert_implEPKcS2_i[_ZN3mma6detail12massert_implEPKcS2_i]+0x112): undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_ostringstream()'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.xdata$_ZN3mma6detail12massert_implEPKcS2_i+0x10): undefined reference to `__gxx_personality_seh0'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma11check_abortEv[_ZN3mma11check_abortEv]+0x2e): undefined reference to `__cxa_allocate_exception'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma11check_abortEv[_ZN3mma11check_abortEv]+0x57): undefined reference to `__cxa_throw'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma6detail7MBufferC1Ey[_ZN3mma6detail7MBufferC1Ey]+0x1a): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::basic_streambuf()'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma6detail7MBufferC1Ey[_ZN3mma6detail7MBufferC1Ey]+0x3c): undefined reference to `std::allocator<char>::allocator()'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma6detail7MBufferC1Ey[_ZN3mma6detail7MBufferC1Ey]+0x62): undefined reference to `std::allocator<char>::~allocator()'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma6detail7MBufferC1Ey[_ZN3mma6detail7MBufferC1Ey]+0x97): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::setp(char*, char*)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma6detail7MBufferC1Ey[_ZN3mma6detail7MBufferC1Ey]+0xa8): undefined reference to `std::allocator<char>::~allocator()'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma6detail7MBufferC1Ey[_ZN3mma6detail7MBufferC1Ey]+0xc9): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::~basic_streambuf()'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.xdata$_ZN3mma6detail7MBufferC1Ey+0x10): undefined reference to `__gxx_personality_seh0'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma6detail14MOutFlushGuardD1Ev[_ZN3mma6detail14MOutFlushGuardD1Ev]+0x14): undefined reference to `std::ostream::flush()'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.xdata$_ZN3mma6detail14MOutFlushGuardD1Ev+0xc): undefined reference to `__gxx_personality_seh0'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma6detail22handleUnknownExceptionEPKcS2_[_ZN3mma6detail22handleUnknownExceptionEPKcS2_]+0x2c): undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream(std::_Ios_Openmode)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma6detail22handleUnknownExceptionEPKcS2_[_ZN3mma6detail22handleUnknownExceptionEPKcS2_]+0x3f): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma6detail22handleUnknownExceptionEPKcS2_[_ZN3mma6detail22handleUnknownExceptionEPKcS2_]+0x51): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma6detail22handleUnknownExceptionEPKcS2_[_ZN3mma6detail22handleUnknownExceptionEPKcS2_]+0x60): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma6detail22handleUnknownExceptionEPKcS2_[_ZN3mma6detail22handleUnknownExceptionEPKcS2_]+0x7b): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma6detail22handleUnknownExceptionEPKcS2_[_ZN3mma6detail22handleUnknownExceptionEPKcS2_]+0x8a): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma6detail22handleUnknownExceptionEPKcS2_[_ZN3mma6detail22handleUnknownExceptionEPKcS2_]+0x9d): undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::str() const'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma6detail22handleUnknownExceptionEPKcS2_[_ZN3mma6detail22handleUnknownExceptionEPKcS2_]+0xc0): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma6detail22handleUnknownExceptionEPKcS2_[_ZN3mma6detail22handleUnknownExceptionEPKcS2_]+0xcc): undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_ostringstream()'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma6detail22handleUnknownExceptionEPKcS2_[_ZN3mma6detail22handleUnknownExceptionEPKcS2_]+0xe0): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma6detail22handleUnknownExceptionEPKcS2_[_ZN3mma6detail22handleUnknownExceptionEPKcS2_]+0xf1): undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_ostringstream()'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.xdata$_ZN3mma6detail22handleUnknownExceptionEPKcS2_+0x10): undefined reference to `__gxx_personality_seh0'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN5Demo15traceEN3mma9MatrixRefIdEE[_ZN5Demo15traceEN3mma9MatrixRefIdEE]+0x34): undefined reference to `__cxa_allocate_exception'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN5Demo15traceEN3mma9MatrixRefIdEE[_ZN5Demo15traceEN3mma9MatrixRefIdEE]+0x43): undefined reference to `std::allocator<char>::allocator()'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN5Demo15traceEN3mma9MatrixRefIdEE[_ZN5Demo15traceEN3mma9MatrixRefIdEE]+0x5d): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN5Demo15traceEN3mma9MatrixRefIdEE[_ZN5Demo15traceEN3mma9MatrixRefIdEE]+0x7e): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN5Demo15traceEN3mma9MatrixRefIdEE[_ZN5Demo15traceEN3mma9MatrixRefIdEE]+0x8a): undefined reference to `std::allocator<char>::~allocator()'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN5Demo15traceEN3mma9MatrixRefIdEE[_ZN5Demo15traceEN3mma9MatrixRefIdEE]+0xa3): undefined reference to `__cxa_throw'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN5Demo15traceEN3mma9MatrixRefIdEE[_ZN5Demo15traceEN3mma9MatrixRefIdEE]+0x116): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN5Demo15traceEN3mma9MatrixRefIdEE[_ZN5Demo15traceEN3mma9MatrixRefIdEE]+0x127): undefined reference to `std::allocator<char>::~allocator()'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN5Demo15traceEN3mma9MatrixRefIdEE[_ZN5Demo15traceEN3mma9MatrixRefIdEE]+0x12f): undefined reference to `__cxa_free_exception'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.xdata$_ZN5Demo15traceEN3mma9MatrixRefIdEE+0x10): undefined reference to `__gxx_personality_seh0'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.xdata+0x6c): undefined reference to `__gxx_personality_seh0'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.xdata+0xc0): undefined reference to `__gxx_personality_seh0'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.xdata$_ZNSt6vectorIcSaIcEEC1EyRKS0_+0xc): undefined reference to `__gxx_personality_seh0'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.xdata$_ZNSt6vectorIcSaIcEED1Ev+0xc): undefined reference to `__gxx_personality_seh0'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.xdata$_ZNSt8_Rb_treeIxSt4pairIKxP5Demo1ESt10_Select1stIS4_ESt4lessIxESaIS4_EED1Ev+0xc): more undefined references to `__gxx_personality_seh0' follow
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma9MatrixRefIdEC1ERKNS_9TensorRefIdEE[_ZN3mma9MatrixRefIdEC1ERKNS_9TensorRefIdEE]+0x4d): undefined reference to `__cxa_allocate_exception'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma9MatrixRefIdEC1ERKNS_9TensorRefIdEE[_ZN3mma9MatrixRefIdEC1ERKNS_9TensorRefIdEE]+0x5c): undefined reference to `std::allocator<char>::allocator()'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma9MatrixRefIdEC1ERKNS_9TensorRefIdEE[_ZN3mma9MatrixRefIdEC1ERKNS_9TensorRefIdEE]+0x76): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma9MatrixRefIdEC1ERKNS_9TensorRefIdEE[_ZN3mma9MatrixRefIdEC1ERKNS_9TensorRefIdEE]+0x97): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma9MatrixRefIdEC1ERKNS_9TensorRefIdEE[_ZN3mma9MatrixRefIdEC1ERKNS_9TensorRefIdEE]+0xa3): undefined reference to `std::allocator<char>::~allocator()'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma9MatrixRefIdEC1ERKNS_9TensorRefIdEE[_ZN3mma9MatrixRefIdEC1ERKNS_9TensorRefIdEE]+0xbc): undefined reference to `__cxa_throw'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma9MatrixRefIdEC1ERKNS_9TensorRefIdEE[_ZN3mma9MatrixRefIdEC1ERKNS_9TensorRefIdEE]+0xff): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma9MatrixRefIdEC1ERKNS_9TensorRefIdEE[_ZN3mma9MatrixRefIdEC1ERKNS_9TensorRefIdEE]+0x110): undefined reference to `std::allocator<char>::~allocator()'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma9MatrixRefIdEC1ERKNS_9TensorRefIdEE[_ZN3mma9MatrixRefIdEC1ERKNS_9TensorRefIdEE]+0x118): undefined reference to `__cxa_free_exception'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.xdata$_ZN3mma9MatrixRefIdEC1ERKNS_9TensorRefIdEE+0x10): undefined reference to `__gxx_personality_seh0'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZNSt12_Vector_baseIcSaIcEE12_Vector_implD1Ev[_ZNSt12_Vector_baseIcSaIcEE12_Vector_implD1Ev]+0x11): undefined reference to `std::allocator<char>::~allocator()'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.xdata$_ZNSt12_Vector_baseIcSaIcEEC2EyRKS0_+0xc): undefined reference to `__gxx_personality_seh0'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.xdata$_ZNSt12_Vector_baseIcSaIcEED2Ev+0xc): undefined reference to `__gxx_personality_seh0'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZNSt6vectorIcSaIcEE17_M_default_appendEy[_ZNSt6vectorIcSaIcEE17_M_default_appendEy]+0x1d8): undefined reference to `__cxa_begin_catch'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZNSt6vectorIcSaIcEE17_M_default_appendEy[_ZNSt6vectorIcSaIcEE17_M_default_appendEy]+0x216): undefined reference to `__cxa_rethrow'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZNSt6vectorIcSaIcEE17_M_default_appendEy[_ZNSt6vectorIcSaIcEE17_M_default_appendEy]+0x21e): undefined reference to `__cxa_end_catch'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.xdata$_ZNSt6vectorIcSaIcEE17_M_default_appendEy+0xc): undefined reference to `__gxx_personality_seh0'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.xdata$_ZNSt6vectorIcSaIcEE15_M_erase_at_endEPc+0xc): undefined reference to `__gxx_personality_seh0'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZNSt8_Rb_treeIxSt4pairIKxP5Demo1ESt10_Select1stIS4_ESt4lessIxESaIS4_EE22_M_emplace_hint_uniqueIJRKSt21piecewise_construct_tSt5tupleIJRS1_EESF_IJEEEEESt17_Rb_tree_iteratorIS4_ESt23_Rb_tree_const_iteratorIS4_EDpOT_[_ZNSt8_Rb_treeIxSt4pairIKxP5Demo1ESt10_Select1stIS4_ESt4lessIxESaIS4_EE22_M_emplace_hint_uniqueIJRKSt21piecewise_construct_tSt5tupleIJRS1_EESF_IJEEEEESt17_Rb_tree_iteratorIS4_ESt23_Rb_tree_const_iteratorIS4_EDpOT_]+0xd6): undefined reference to `__cxa_begin_catch'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZNSt8_Rb_treeIxSt4pairIKxP5Demo1ESt10_Select1stIS4_ESt4lessIxESaIS4_EE22_M_emplace_hint_uniqueIJRKSt21piecewise_construct_tSt5tupleIJRS1_EESF_IJEEEEESt17_Rb_tree_iteratorIS4_ESt23_Rb_tree_const_iteratorIS4_EDpOT_[_ZNSt8_Rb_treeIxSt4pairIKxP5Demo1ESt10_Select1stIS4_ESt4lessIxESaIS4_EE22_M_emplace_hint_uniqueIJRKSt21piecewise_construct_tSt5tupleIJRS1_EESF_IJEEEEESt17_Rb_tree_iteratorIS4_ESt23_Rb_tree_const_iteratorIS4_EDpOT_]+0xeb): undefined reference to `__cxa_rethrow'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZNSt8_Rb_treeIxSt4pairIKxP5Demo1ESt10_Select1stIS4_ESt4lessIxESaIS4_EE22_M_emplace_hint_uniqueIJRKSt21piecewise_construct_tSt5tupleIJRS1_EESF_IJEEEEESt17_Rb_tree_iteratorIS4_ESt23_Rb_tree_const_iteratorIS4_EDpOT_[_ZNSt8_Rb_treeIxSt4pairIKxP5Demo1ESt10_Select1stIS4_ESt4lessIxESaIS4_EE22_M_emplace_hint_uniqueIJRKSt21piecewise_construct_tSt5tupleIJRS1_EESF_IJEEEEESt17_Rb_tree_iteratorIS4_ESt23_Rb_tree_const_iteratorIS4_EDpOT_]+0xf3): undefined reference to `__cxa_end_catch'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.xdata$_ZNSt8_Rb_treeIxSt4pairIKxP5Demo1ESt10_Select1stIS4_ESt4lessIxESaIS4_EE22_M_emplace_hint_uniqueIJRKSt21piecewise_construct_tSt5tupleIJRS1_EESF_IJEEEEESt17_Rb_tree_iteratorIS4_ESt23_Rb_tree_const_iteratorIS4_EDpOT_+0x10): undefined reference to `__gxx_personality_seh0'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZNSt23_Rb_tree_const_iteratorISt4pairIKxP5Demo1EEppEv[_ZNSt23_Rb_tree_const_iteratorISt4pairIKxP5Demo1EEppEv]+0x17): undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base const*)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZNSt12_Vector_baseIcSaIcEE12_Vector_implC1ERKS0_[_ZNSt12_Vector_baseIcSaIcEE12_Vector_implC1ERKS0_]+0x1c): undefined reference to `std::allocator<char>::allocator(std::allocator<char> const&)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZNKSt6vectorIcSaIcEE12_M_check_lenEyPKc[_ZNKSt6vectorIcSaIcEE12_M_check_lenEyPKc]+0x4b): undefined reference to `std::__throw_length_error(char const*)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZNSt8_Rb_treeIxSt4pairIKxP5Demo1ESt10_Select1stIS4_ESt4lessIxESaIS4_EE14_M_insert_nodeEPSt18_Rb_tree_node_baseSC_PSt13_Rb_tree_nodeIS4_E[_ZNSt8_Rb_treeIxSt4pairIKxP5Demo1ESt10_Select1stIS4_ESt4lessIxESaIS4_EE14_M_insert_nodeEPSt18_Rb_tree_node_baseSC_PSt13_Rb_tree_nodeIS4_E]+0x8d): undefined reference to `std::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma10makeTensorIxEENS_9TensorRefIT_EESt16initializer_listIxE[_ZN3mma10makeTensorIxEENS_9TensorRefIT_EESt16initializer_listIxE]+0x7d): undefined reference to `__cxa_allocate_exception'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma10makeTensorIxEENS_9TensorRefIT_EESt16initializer_listIxE[_ZN3mma10makeTensorIxEENS_9TensorRefIT_EESt16initializer_listIxE]+0x8c): undefined reference to `std::allocator<char>::allocator()'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma10makeTensorIxEENS_9TensorRefIT_EESt16initializer_listIxE[_ZN3mma10makeTensorIxEENS_9TensorRefIT_EESt16initializer_listIxE]+0xa6): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma10makeTensorIxEENS_9TensorRefIT_EESt16initializer_listIxE[_ZN3mma10makeTensorIxEENS_9TensorRefIT_EESt16initializer_listIxE]+0xc7): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma10makeTensorIxEENS_9TensorRefIT_EESt16initializer_listIxE[_ZN3mma10makeTensorIxEENS_9TensorRefIT_EESt16initializer_listIxE]+0xd3): undefined reference to `std::allocator<char>::~allocator()'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma10makeTensorIxEENS_9TensorRefIT_EESt16initializer_listIxE[_ZN3mma10makeTensorIxEENS_9TensorRefIT_EESt16initializer_listIxE]+0xec): undefined reference to `__cxa_throw'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma10makeTensorIxEENS_9TensorRefIT_EESt16initializer_listIxE[_ZN3mma10makeTensorIxEENS_9TensorRefIT_EESt16initializer_listIxE]+0x10d): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma10makeTensorIxEENS_9TensorRefIT_EESt16initializer_listIxE[_ZN3mma10makeTensorIxEENS_9TensorRefIT_EESt16initializer_listIxE]+0x11e): undefined reference to `std::allocator<char>::~allocator()'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma10makeTensorIxEENS_9TensorRefIT_EESt16initializer_listIxE[_ZN3mma10makeTensorIxEENS_9TensorRefIT_EESt16initializer_listIxE]+0x126): undefined reference to `__cxa_free_exception'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.xdata$_ZN3mma10makeTensorIxEENS_9TensorRefIT_EESt16initializer_listIxE+0x10): undefined reference to `__gxx_personality_seh0'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.xdata$_ZNSt8_Rb_treeIxSt4pairIKxP5Demo1ESt10_Select1stIS4_ESt4lessIxESaIS4_EE15_M_destroy_nodeEPSt13_Rb_tree_nodeIS4_E+0xc): undefined reference to `__gxx_personality_seh0'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.xdata$_ZNSt8_Rb_treeIxSt4pairIKxP5Demo1ESt10_Select1stIS4_ESt4lessIxESaIS4_EE11_M_put_nodeEPSt13_Rb_tree_nodeIS4_E+0xc): undefined reference to `__gxx_personality_seh0'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZNSt8_Rb_treeIxSt4pairIKxP5Demo1ESt10_Select1stIS4_ESt4lessIxESaIS4_EE17_M_construct_nodeIJRKSt21piecewise_construct_tSt5tupleIJRS1_EESF_IJEEEEEvPSt13_Rb_tree_nodeIS4_EDpOT_[_ZNSt8_Rb_treeIxSt4pairIKxP5Demo1ESt10_Select1stIS4_ESt4lessIxESaIS4_EE17_M_construct_nodeIJRKSt21piecewise_construct_tSt5tupleIJRS1_EESF_IJEEEEEvPSt13_Rb_tree_nodeIS4_EDpOT_]+0x8f): undefined reference to `__cxa_begin_catch'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZNSt8_Rb_treeIxSt4pairIKxP5Demo1ESt10_Select1stIS4_ESt4lessIxESaIS4_EE17_M_construct_nodeIJRKSt21piecewise_construct_tSt5tupleIJRS1_EESF_IJEEEEEvPSt13_Rb_tree_nodeIS4_EDpOT_[_ZNSt8_Rb_treeIxSt4pairIKxP5Demo1ESt10_Select1stIS4_ESt4lessIxESaIS4_EE17_M_construct_nodeIJRKSt21piecewise_construct_tSt5tupleIJRS1_EESF_IJEEEEEvPSt13_Rb_tree_nodeIS4_EDpOT_]+0xa4): undefined reference to `__cxa_rethrow'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZNSt8_Rb_treeIxSt4pairIKxP5Demo1ESt10_Select1stIS4_ESt4lessIxESaIS4_EE17_M_construct_nodeIJRKSt21piecewise_construct_tSt5tupleIJRS1_EESF_IJEEEEEvPSt13_Rb_tree_nodeIS4_EDpOT_[_ZNSt8_Rb_treeIxSt4pairIKxP5Demo1ESt10_Select1stIS4_ESt4lessIxESaIS4_EE17_M_construct_nodeIJRKSt21piecewise_construct_tSt5tupleIJRS1_EESF_IJEEEEEvPSt13_Rb_tree_nodeIS4_EDpOT_]+0xac): undefined reference to `__cxa_end_catch'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.xdata$_ZNSt8_Rb_treeIxSt4pairIKxP5Demo1ESt10_Select1stIS4_ESt4lessIxESaIS4_EE17_M_construct_nodeIJRKSt21piecewise_construct_tSt5tupleIJRS1_EESF_IJEEEEEvPSt13_Rb_tree_nodeIS4_EDpOT_+0x14): undefined reference to `__gxx_personality_seh0'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZNSt17_Rb_tree_iteratorISt4pairIKxP5Demo1EEmmEv[_ZNSt17_Rb_tree_iteratorISt4pairIKxP5Demo1EEmmEv]+0x17): undefined reference to `std::_Rb_tree_decrement(std::_Rb_tree_node_base*)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZNSt17_Rb_tree_iteratorISt4pairIKxP5Demo1EEppEv[_ZNSt17_Rb_tree_iteratorISt4pairIKxP5Demo1EEppEv]+0x17): undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base*)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.xdata$_ZNSt8_Rb_treeIxSt4pairIKxP5Demo1ESt10_Select1stIS4_ESt4lessIxESaIS4_EE5clearEv+0xc): undefined reference to `__gxx_personality_seh0'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZNSt23_Rb_tree_const_iteratorISt4pairIKxP5Demo1EEppEi[_ZNSt23_Rb_tree_const_iteratorISt4pairIKxP5Demo1EEppEi]+0x25): undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base const*)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZNSt8_Rb_treeIxSt4pairIKxP5Demo1ESt10_Select1stIS4_ESt4lessIxESaIS4_EE12_M_erase_auxESt23_Rb_tree_const_iteratorIS4_E[_ZNSt8_Rb_treeIxSt4pairIKxP5Demo1ESt10_Select1stIS4_ESt4lessIxESaIS4_EE12_M_erase_auxESt23_Rb_tree_const_iteratorIS4_E]+0x20): undefined reference to `std::_Rb_tree_rebalance_for_erase(std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN9__gnu_cxx13new_allocatorIcE10deallocateEPcy[_ZN9__gnu_cxx13new_allocatorIcE10deallocateEPcy]+0x1c): undefined reference to `operator delete(void*)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN9__gnu_cxx13new_allocatorIcE8allocateEyPKv[_ZN9__gnu_cxx13new_allocatorIcE8allocateEyPKv]+0x29): undefined reference to `std::__throw_bad_alloc()'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN9__gnu_cxx13new_allocatorIcE8allocateEyPKv[_ZN9__gnu_cxx13new_allocatorIcE8allocateEyPKv]+0x35): undefined reference to `operator new(unsigned long long)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN9__gnu_cxx13new_allocatorISt13_Rb_tree_nodeISt4pairIKxP5Demo1EEE10deallocateEPS7_y[_ZN9__gnu_cxx13new_allocatorISt13_Rb_tree_nodeISt4pairIKxP5Demo1EEE10deallocateEPS7_y]+0x1c): undefined reference to `operator delete(void*)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN9__gnu_cxx13new_allocatorISt13_Rb_tree_nodeISt4pairIKxP5Demo1EEE8allocateEyPKv[_ZN9__gnu_cxx13new_allocatorISt13_Rb_tree_nodeISt4pairIKxP5Demo1EEE8allocateEyPKv]+0x29): undefined reference to `std::__throw_bad_alloc()'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN9__gnu_cxx13new_allocatorISt13_Rb_tree_nodeISt4pairIKxP5Demo1EEE8allocateEyPKv[_ZN9__gnu_cxx13new_allocatorISt13_Rb_tree_nodeISt4pairIKxP5Demo1EEE8allocateEyPKv]+0x42): undefined reference to `operator new(unsigned long long)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.xdata$_ZN9__gnu_cxx13new_allocatorISt13_Rb_tree_nodeISt4pairIKxP5Demo1EEE9constructIS6_JRKSt21piecewise_construct_tSt5tupleIJRS3_EESD_IJEEEEEvPT_DpOT0_+0x10): undefined reference to `__gxx_personality_seh0'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.rdata$_ZTVN3mma6detail7MBufferE[_ZTVN3mma6detail7MBufferE]+0x20): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::imbue(std::locale const&)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.rdata$_ZTVN3mma6detail7MBufferE[_ZTVN3mma6detail7MBufferE]+0x28): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::setbuf(char*, long long)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.rdata$_ZTVN3mma6detail7MBufferE[_ZTVN3mma6detail7MBufferE]+0x30): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::seekoff(long long, std::_Ios_Seekdir, std::_Ios_Openmode)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.rdata$_ZTVN3mma6detail7MBufferE[_ZTVN3mma6detail7MBufferE]+0x38): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::seekpos(std::fpos<int>, std::_Ios_Openmode)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.rdata$_ZTVN3mma6detail7MBufferE[_ZTVN3mma6detail7MBufferE]+0x48): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::showmanyc()'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.rdata$_ZTVN3mma6detail7MBufferE[_ZTVN3mma6detail7MBufferE]+0x50): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::xsgetn(char*, long long)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.rdata$_ZTVN3mma6detail7MBufferE[_ZTVN3mma6detail7MBufferE]+0x58): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::underflow()'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.rdata$_ZTVN3mma6detail7MBufferE[_ZTVN3mma6detail7MBufferE]+0x60): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::uflow()'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.rdata$_ZTVN3mma6detail7MBufferE[_ZTVN3mma6detail7MBufferE]+0x68): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::pbackfail(int)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.rdata$_ZTVN3mma6detail7MBufferE[_ZTVN3mma6detail7MBufferE]+0x70): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::xsputn(char const*, long long)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma6detail7MBufferD1Ev[_ZN3mma6detail7MBufferD1Ev]+0x32): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::~basic_streambuf()'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.text$_ZN3mma6detail7MBufferD0Ev[_ZN3mma6detail7MBufferD0Ev]+0x1a): undefined reference to `operator delete(void*)'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.rdata$_ZTIN3mma6detail7MBufferE[_ZTIN3mma6detail7MBufferE]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.rdata$_ZTIN3mma6detail7MBufferE[_ZTIN3mma6detail7MBufferE]+0x10): undefined reference to `typeinfo for std::basic_streambuf<char, std::char_traits<char> >'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.rdata$_ZTIN3mma12LibraryErrorE[_ZTIN3mma12LibraryErrorE]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
C:\Users\xxx\AppData\Local\Temp\ccINEAJd.o:LTemplate-DemoLib.cpp:(.rdata$_ZTISt9exception[_ZTISt9exception]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
collect2.exe: error: ld returned 1 exit status
szhorvat commented 4 years ago

It'll be a while before I can find the time to look at this (Windows is not my main system), but this is very likely because of a bad compiler configuration. MinGW-w64 is not officially supported by Mathematica. Setting all command-line options is not trivial. For example, the flags to link to the MathLink libraries are missing. As I remember, the .lib files supplied with Mathematica had to be converted to .a ones to work with MinGW, and there were some subtleties with that. I haven't tried to set up MinGW with Mathematica in many years.

Generally, DON'T use MinGW unless you have a really good reason to do so. Use MSVC instead.

lavender-lee commented 4 years ago

Thanks szhorvat. The reason I use MinGW-64 is just avoiding installing Microsoft Visual Studio 2015. It is very large(5G in C disk and 3G in the install-path). Maybe I can use the code that generated from LTemplate and then build a project via CMake in CLion. Anyway thanks for guiding.

szhorvat commented 4 years ago

and then build a project via CMake

I don't think that will make a difference here. The issue is still to use the correct command line flags, linking the appropriate libraries, and make sure that the libraries are in a format compatible with this toolchain.

This is also not LTemplate specific: the same problems would come up when compiling any LibraryLink stuff. What makes LTemplate a bit more demanding is that it uses C++ and that it requires linking to MathLink (that's not necessary for libraries that don't use any MathLink functions).

cnkjw commented 4 years ago

Hello @ShutaoTang and @szhorvat ,

I found that this problem can be easily solved.

First, set MinGW64 g++ as C compiler (Not gcc.exe)

<< CCompilerDriver`GenericCCompiler`
$CCompiler = {"Compiler" -> GenericCCompiler, "CompilerInstallation" -> 
    "C:\\opt\\mingw64\\bin", "CompilerName" -> "g++.exe"};

Note: Unfortunately, this may render Compile[] unavailable.

Second, We specify the location of ml64i4.dll and WolframRTL.dll in CompileOptions, as follow,

CompileTemplate[template, "CompileOptions" -> 
  "C:/opt/MMA/ml64i4.dll C:/opt/MMA/WolframRTL.dll"]

You can find ml64i4.dll and WolframRTL.dll in [Mathematica Installation Directory]\SystemFiles\Libraries\Windows-x86-64. Because this path is too long, I copied them to C:/opt/MMA/.

Now, we can use MinGW64 to compile code.

My platform information as follows:

lavender-lee commented 4 years ago

@K-JW Interesting and thanks for sharing this:)

cnkjw commented 4 years ago

Update

If the Mathematica version is not 11.3, then the following error may be reported:

CreateLibrary::cmperr: Compile error: D:\Program Files\Wolfram Research\Mathematica\12.1\SystemFiles\Links\MathLink\DeveloperKit\Windows-x86-64\CompilerAdditions/mathlink.h:641:9: error: '__int64' does not name a type; did you mean 'wint64'?

Please add additional compilation flags: -D__int64="long long".

CompileTemplate[template, "CompileOptions" -> 
  "C:/opt/MMA/ml64i4.dll C:/opt/MMA/WolframRTL.dll -D__int64=\"long long\""]

That's all. hope it is helpful.

szhorvat commented 4 years ago

I can't comment much on this today (deadlines...) but please try using the MinGW driver, not the GenericCompiler driver. I know that's not what the documentation says, but the documentation is outdated.