btzy/nativefiledialog-extended

Problems with linking using a simple Makefile.

shampee opened this issue · 3 comments

gcc editor.c SDL_FontCache.c -g -lSDL2 -lSDL2_image -lSDL2_ttf submodules/nativefiledialog-extended/build/src/libnfd.a -o editor
gives me:
/bin/ld: submodules/nativefiledialog-extended/build/src/libnfd.a(nfd_gtk.cpp.o): undefined reference to symbol 'g_free' /bin/ld: /lib/x86_64-linux-gnu/libglib-2.0.so.0: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status make: *** [Makefile:19: all] Error 1

I have little to no experience with cmake. How do I go about solving this issue?

Same result unfortunately
gcc editor.c SDL_FontCache.c -g -pthread -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/harfbuzz -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/x86_64-linux-gnu -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -lSDL2 -lSDL2_image -lSDL2_ttf -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 submodules/nativefiledialog-extended/build/src/libnfd.a -o editor

/bin/ld: submodules/nativefiledialog-extended/build/src/libnfd.a(nfd_gtk.cpp.o): undefined reference to symbol 'g_free' /bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libglib-2.0.so: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status make: *** [Makefile:20: all] Error 1

My bad I just had to reorder the arguments: gcc editor.c SDL_FontCache.c submodules/nativefiledialog-extended/build/src/libnfd.a ...
Thanks