uibuilder.nim icon indicating copy to clipboard operation
uibuilder.nim copied to clipboard

failed to compile on Windows with Mingw64

Open retsyo opened this issue 7 years ago • 3 comments

nimble install uibuilder

... CC: debug
        ... Hint:  [Link]
        ... C:\Users\LOVLJIDY\nimcache\uibuilder_r\win_alloc.cpp.obj:alloc.cpp:(.text+0x30): undefined reference to `std::ios_base::ios_base()'
        ... C:\Users\LOVLJIDY\nimcache\uibuilder_r\win_alloc.cpp.obj:alloc.cpp:(.text+0xc8): undefined reference to `std::basic_ios<char, std::char_traits<char> >::init(std::basic_streambuf<char, std::char_traits<char> >*)'
        ... C:\Users\USER\nimcache\uibuilder_r\win_alloc.cpp.obj:alloc.cpp:(.text+0x126): undefined reference to `std::locale::locale()'
        ... C:\Users\USER\nimcache\uibuilder_r\win_alloc.cpp.obj:alloc.cpp:(.text+0x171): undefined reference to `std::basic_ios<char, std::char_traits<char> >::init(std::basic_streambuf<char, std::char_traits<char> >*)'

and so many errors

retsyo avatar Nov 03 '18 10:11 retsyo

do you have libstdc++ installed?

ba0f3 avatar Nov 05 '18 03:11 ba0f3

I have I can compile

#include <string>
#include <iostream>

int main(){
    std::string s;
    s = "Hello World!";
    std::cout << s << '\n';
}

by using g++ a.cc, then

$ ./a.exe
Hello World!

$ ldd a.exe
        ntdll.dll => /c/Windows/SYSTEM32/ntdll.dll (0x77c20000)
        kernel32.dll => /c/Windows/system32/kernel32.dll (0x77a00000)
        KERNELBASE.dll => /c/Windows/system32/KERNELBASE.dll (0x7fefd8a0000)
        msvcrt.dll => /c/Windows/system32/msvcrt.dll (0x7feffce0000)
        libgcc_s_seh-1.dll => /mingw64/bin/libgcc_s_seh-1.dll (0x61440000)
        libwinpthread-1.dll => /mingw64/bin/libwinpthread-1.dll (0x64940000)
        libstdc++-6.dll => /mingw64/bin/libstdc++-6.dll (0x6fc40000)
        USER32.dll => /c/Windows/system32/USER32.dll (0x77b20000)
        GDI32.dll => /c/Windows/system32/GDI32.dll (0x7fefeec0000)
        LPK.dll => /c/Windows/system32/LPK.dll (0x7fefdc20000)
        USP10.dll => /c/Windows/system32/USP10.dll (0x7fefdfc0000)

retsyo avatar Nov 05 '18 11:11 retsyo

if I add {.passL: "-lstdc++" .} on the header of uibuilder.nim, then

$ nim c -r uibuilder.nim
... ...
uibuilder.nim(142, 18) Warning: only GtkMenuItem and GtkCheckMenuItem is supported [User]
Hint:  [Link]
Hint: operation successful (70791 lines compiled; 113.051 sec total; 60.176MiB peakmem; Debug Build) [SuccessX]
Hint: E:\msys64\home\USER\_nim\ba0f3-uibuilder\uibuilder.exe  [Exec]
Error: execution of an external program failed: 'E:\msys64\home\USER\_nim\ba0f3-uibuilder\uibuilder.exe '

$ ldd uibuilder.exe
        ntdll.dll => /c/Windows/SYSTEM32/ntdll.dll (0x77c20000)
        kernel32.dll => /c/Windows/system32/kernel32.dll (0x77a00000)
        KERNELBASE.dll => /c/Windows/system32/KERNELBASE.dll (0x7fefd8a0000)
        COMCTL32.dll => /c/Windows/WinSxS/amd64_microsoft.windows.common-controls_6595b64144ccf1df_5.82.7601.18837_none_a4d981ff711297b6/COMCTL32.dll (0x7fef9ab0000)
        ADVAPI32.dll => /c/Windows/system32/ADVAPI32.dll (0x7fefdee0000)
        msvcrt.dll => /c/Windows/system32/msvcrt.dll (0x7feffce0000)
        sechost.dll => /c/Windows/SYSTEM32/sechost.dll (0x7fefe090000)
        RPCRT4.dll => /c/Windows/system32/RPCRT4.dll (0x7fefddb0000)
        GDI32.dll => /c/Windows/system32/GDI32.dll (0x7fefeec0000)
        USER32.dll => /c/Windows/system32/USER32.dll (0x77b20000)
        LPK.dll => /c/Windows/system32/LPK.dll (0x7fefdc20000)
        USP10.dll => /c/Windows/system32/USP10.dll (0x7fefdfc0000)

retsyo avatar Nov 05 '18 11:11 retsyo