andlabs / libui

Simple and portable (but not inflexible) GUI library in C that uses the native GUI technologies of each platform it supports.
Other
10.74k stars 616 forks source link

undefined reference to `DWriteCreateFactory' #518

Open fxqy opened 3 years ago

fxqy commented 3 years ago

What else do I need to add to the link options? image

fxqy commented 3 years ago

-lui -lgdi32 -lcomctl32 -ld2d1 -lole32 -ldwrite -lstdc++ -lgcc_s -lgcc_eh -lwinpthread I added these libraries and compiled them, but I couldn't run them

C:\Windows\system32\cmd.exe /C C:/msys64/mingw64/bin/mingw32-make.exe -j4 SHELL=cmd.exe -e -f  Makefile
"----------Building project:[ luia - Debug ]----------"
mingw32-make[1]: Entering directory 'D:/Dev/c/codelitespace/luia'
C:/msys64/mingw64/bin/x86_64-w64-mingw32-g++.exe -o Debug/luia @"luia.txt" -L. -LD:\dev\c\libui\build\meson-out   -lui -lgdi32 -lcomctl32 -ld2d1 -lole32 -ldwrite -lstdc++ -lgcc_s -lgcc_eh -lwinpthread
mingw32-make[1]: Leaving directory 'D:/Dev/c/codelitespace/luia'
====0 errors, 0 warnings====

image

fxqy commented 3 years ago

It is not okay to add all the ‘*.dll’ files to run image

msink commented 3 years ago

Did you try to copy your .exe to C:/msys64/mingw64/bin and execute from there? If it runs - probably you missed one or more .dll

msink commented 3 years ago

Or add "-Wl,-Bstatic -lstdc++ -static" before libs list to link them statically.

fxqy commented 3 years ago

Did you try to copy your .exe to C:/msys64/mingw64/bin and execute from there? If it runs - probably you missed one or more .dll It's still wrong! image

fxqy commented 3 years ago

Or add "-Wl,-Bstatic -lstdc++ -static" before libs list to link them statically.

C:\Windows\system32\cmd.exe /C C:/msys64/mingw64/bin/mingw32-make.exe -j4 SHELL=cmd.exe -e -f  Makefile
"----------Building project:[ luia - Debug ]----------"
mingw32-make[1]: Entering directory 'D:/Dev/c/codelitespace/luia'
C:/msys64/mingw64/bin/x86_64-w64-mingw32-g++.exe -o Debug/luia @"luia.txt" -L. -LD:\dev\c\libui\build\meson-out   -Wl,-Bstatic -lstdc++ -static -lui -lgdi32 -lcomctl32 -ld2d1 -lole32 -ldwrite -lgcc_s -lgcc_eh -lwinpthread
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0\libgcc_eh.a(unwind-seh.o):(.text+0x3d0): multiple definition of `_Unwind_Resume'; C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0\libgcc_s.a(d000015.o):(.text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
mingw32-make[1]: *** [luia.mk:81: Debug/luia] Error 1
mingw32-make: *** [Makefile:5: All] Error 2
mingw32-make[1]: Leaving directory 'D:/Dev/c/codelitespace/luia'
====0 errors, 0 warnings====

The compilation report is wrong image

andlabs commented 3 years ago

I think -lgcc_s and -lgcc_eh are mutually exclusive, however if you are trying to statically link libgcc, then the option you want is really -static-libgcc.