c++ - Delay Loading DWMAPI on Windows XP and CodeBlocks -


i have project i'm been fighting build windows (xp) month solid now. project uses gtkmm-3, c++, , latest gcc-tdm compiler. ide codeblocks 13.14.

i'm making progress, however, getting hung on error message...

ld.exe cannot find -ldwmapi

now, dwmapi dll available on windows vista , above. according research, can delay loading of dlls in cases present on some systems, not on others.

the problem is, have no clue how on codeblocks. -z lazy option not accomplish this. if delay loading impossible, how around dwmapi dependency. there has way!

full build command: (errors @ bottom)

-------------- clean: debug in infiltrator (compiler: gnu gcc compiler)---------------  cleaned "infiltrator - debug"  -------------- build: debug in infiltrator (compiler: gnu gcc compiler)---------------  mingw32-g++-dw2.exe -std=c++11 -wall -mms-bitfields -pthread -ic:/dev/mingw/include/glibmm-2.4 -ic:/dev/mingw/lib/glibmm-2.4/include -ic:/dev/mingw/include/sigc++-2.0 -ic:/dev/mingw/lib/sigc++-2.0/include -ic:/dev/mingw/include/glib-2.0 -ic:/dev/mingw/lib/glib-2.0/include -ic:/dev/mingw/include/gtkmm-3.0 -ic:/dev/mingw/lib/gtkmm-3.0/include -ic:/dev/mingw/include/atkmm-1.6 -ic:/dev/mingw/include/giomm-2.4 -ic:/dev/mingw/lib/giomm-2.4/include -ic:/dev/mingw/include/pangomm-1.4 -ic:/dev/mingw/lib/pangomm-1.4/include -ic:/dev/mingw/include/gtk-3.0 -ic:/dev/mingw/include/cairomm-1.0 -ic:/dev/mingw/lib/cairomm-1.0/include -ic:/dev/mingw/include/gdk-pixbuf-2.0 -ic:/dev/mingw/include/gdkmm-3.0 -ic:/dev/mingw/lib/gdkmm-3.0/include -ic:/dev/mingw/include/atk-1.0 -ic:/dev/mingw/include/pango-1.0 -ic:/dev/mingw/include/cairo -ic:/dev/mingw/include/pixman-1 -ic:/dev/mingw/include -i/mingw32/include/freetype2 -i/mingw32/include/libpng16 -i/mingw32/include/harfbuzz -i/mingw32/include/glib-2.0 -i/mingw32/lib/glib-2.0/include -i/mingw32/include -ic:/dev/mingw/include/freetype2 -ic:/dev/mingw/include/libpng16 -ic:/dev/mingw/include/harfbuzz -wl,-luuid -lc:/dev/mingw/lib -lgtkmm-3.0 -latkmm-1.6 -lgdkmm-3.0 -lgiomm-2.4 -lpangomm-1.4 -lgtk-3 -lglibmm-2.4 -lcairomm-1.0 -lgdk-3 -lgdi32 -limm32 -lshell32 -lole32 -lwinmm -ldwmapi -lz -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lpango-1.0 -lcairo -lsigc-2.0 -lgobject-2.0 -lglib-2.0 -lintl -std=c++11 -wall -g -mms-bitfields -pthread -ic:/dev/mingw/include/glibmm-2.4 -ic:/dev/mingw/lib/glibmm-2.4/include -ic:/dev/mingw/include/sigc++-2.0 -ic:/dev/mingw/lib/sigc++-2.0/include -ic:/dev/mingw/include/glib-2.0 -ic:/dev/mingw/lib/glib-2.0/include -ic:/dev/mingw/include/gtkmm-3.0 -ic:/dev/mingw/lib/gtkmm-3.0/include -ic:/dev/mingw/include/atkmm-1.6 -ic:/dev/mingw/include/giomm-2.4 -ic:/dev/mingw/lib/giomm-2.4/include -ic:/dev/mingw/include/pangomm-1.4 -ic:/dev/mingw/lib/pangomm-1.4/include -ic:/dev/mingw/include/gtk-3.0 -ic:/dev/mingw/include/cairomm-1.0 -ic:/dev/mingw/lib/cairomm-1.0/include -ic:/dev/mingw/include/gdk-pixbuf-2.0 -ic:/dev/mingw/include/gdkmm-3.0 -ic:/dev/mingw/lib/gdkmm-3.0/include -ic:/dev/mingw/include/atk-1.0 -ic:/dev/mingw/include/pango-1.0 -ic:/dev/mingw/include/cairo -ic:/dev/mingw/include/pixman-1 -ic:/dev/mingw/include -i/mingw32/include/freetype2 -i/mingw32/include/libpng16 -i/mingw32/include/harfbuzz -i/mingw32/include/glib-2.0 -i/mingw32/lib/glib-2.0/include -i/mingw32/include -ic:/dev/mingw/include/freetype2 -ic:/dev/mingw/include/libpng16 -ic:/dev/mingw/include/harfbuzz -wl,-luuid -lc:/dev/mingw/lib -lgtkmm-3.0 -latkmm-1.6 -lgdkmm-3.0 -lgiomm-2.4 -lpangomm-1.4 -lgtk-3 -lglibmm-2.4 -lcairomm-1.0 -lgdk-3 -lgdi32 -limm32 -lshell32 -lole32 -lwinmm -ldwmapi -lz -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lpango-1.0 -lcairo -lsigc-2.0 -lgobject-2.0 -lglib-2.0 -lintl -z lazy -std=c++11 -mms-bitfields -pthread -ic:/dev/mingw/include/glibmm-2.4 -ic:/dev/mingw/lib/glibmm-2.4/include -ic:/dev/mingw/include/sigc++-2.0 -ic:/dev/mingw/lib/sigc++-2.0/include -ic:/dev/mingw/include/glib-2.0 -ic:/dev/mingw/lib/glib-2.0/include -ic:/dev/mingw/include/gtkmm-3.0 -ic:/dev/mingw/lib/gtkmm-3.0/include -ic:/dev/mingw/include/atkmm-1.6 -ic:/dev/mingw/include/giomm-2.4 -ic:/dev/mingw/lib/giomm-2.4/include -ic:/dev/mingw/include/pangomm-1.4 -ic:/dev/mingw/lib/pangomm-1.4/include -ic:/dev/mingw/include/gtk-3.0 -ic:/dev/mingw/include/cairomm-1.0 -ic:/dev/mingw/lib/cairomm-1.0/include -ic:/dev/mingw/include/gdk-pixbuf-2.0 -ic:/dev/mingw/include/gdkmm-3.0 -ic:/dev/mingw/lib/gdkmm-3.0/include -ic:/dev/mingw/include/atk-1.0 -ic:/dev/mingw/include/pango-1.0 -ic:/dev/mingw/include/cairo -ic:/dev/mingw/include/pixman-1 -ic:/dev/mingw/include -i/mingw32/include/freetype2 -i/mingw32/include/libpng16 -i/mingw32/include/harfbuzz -i/mingw32/include/glib-2.0 -i/mingw32/lib/glib-2.0/include -i/mingw32/include -ic:/dev/mingw/include/freetype2 -ic:/dev/mingw/include/libpng16 -ic:/dev/mingw/include/harfbuzz -iinclude -ic:\dev\mingw\include -c "c:\documents , settings\jason\desktop\infiltrator\main.cpp" -o obj\debug\main.o mingw32-g++-dw2.exe -std=c++11 -wall -mms-bitfields -pthread -ic:/dev/mingw/include/glibmm-2.4 -ic:/dev/mingw/lib/glibmm-2.4/include -ic:/dev/mingw/include/sigc++-2.0 -ic:/dev/mingw/lib/sigc++-2.0/include -ic:/dev/mingw/include/glib-2.0 -ic:/dev/mingw/lib/glib-2.0/include -ic:/dev/mingw/include/gtkmm-3.0 -ic:/dev/mingw/lib/gtkmm-3.0/include -ic:/dev/mingw/include/atkmm-1.6 -ic:/dev/mingw/include/giomm-2.4 -ic:/dev/mingw/lib/giomm-2.4/include -ic:/dev/mingw/include/pangomm-1.4 -ic:/dev/mingw/lib/pangomm-1.4/include -ic:/dev/mingw/include/gtk-3.0 -ic:/dev/mingw/include/cairomm-1.0 -ic:/dev/mingw/lib/cairomm-1.0/include -ic:/dev/mingw/include/gdk-pixbuf-2.0 -ic:/dev/mingw/include/gdkmm-3.0 -ic:/dev/mingw/lib/gdkmm-3.0/include -ic:/dev/mingw/include/atk-1.0 -ic:/dev/mingw/include/pango-1.0 -ic:/dev/mingw/include/cairo -ic:/dev/mingw/include/pixman-1 -ic:/dev/mingw/include -i/mingw32/include/freetype2 -i/mingw32/include/libpng16 -i/mingw32/include/harfbuzz -i/mingw32/include/glib-2.0 -i/mingw32/lib/glib-2.0/include -i/mingw32/include -ic:/dev/mingw/include/freetype2 -ic:/dev/mingw/include/libpng16 -ic:/dev/mingw/include/harfbuzz -wl,-luuid -lc:/dev/mingw/lib -lgtkmm-3.0 -latkmm-1.6 -lgdkmm-3.0 -lgiomm-2.4 -lpangomm-1.4 -lgtk-3 -lglibmm-2.4 -lcairomm-1.0 -lgdk-3 -lgdi32 -limm32 -lshell32 -lole32 -lwinmm -ldwmapi -lz -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lpango-1.0 -lcairo -lsigc-2.0 -lgobject-2.0 -lglib-2.0 -lintl -std=c++11 -wall -g -mms-bitfields -pthread -ic:/dev/mingw/include/glibmm-2.4 -ic:/dev/mingw/lib/glibmm-2.4/include -ic:/dev/mingw/include/sigc++-2.0 -ic:/dev/mingw/lib/sigc++-2.0/include -ic:/dev/mingw/include/glib-2.0 -ic:/dev/mingw/lib/glib-2.0/include -ic:/dev/mingw/include/gtkmm-3.0 -ic:/dev/mingw/lib/gtkmm-3.0/include -ic:/dev/mingw/include/atkmm-1.6 -ic:/dev/mingw/include/giomm-2.4 -ic:/dev/mingw/lib/giomm-2.4/include -ic:/dev/mingw/include/pangomm-1.4 -ic:/dev/mingw/lib/pangomm-1.4/include -ic:/dev/mingw/include/gtk-3.0 -ic:/dev/mingw/include/cairomm-1.0 -ic:/dev/mingw/lib/cairomm-1.0/include -ic:/dev/mingw/include/gdk-pixbuf-2.0 -ic:/dev/mingw/include/gdkmm-3.0 -ic:/dev/mingw/lib/gdkmm-3.0/include -ic:/dev/mingw/include/atk-1.0 -ic:/dev/mingw/include/pango-1.0 -ic:/dev/mingw/include/cairo -ic:/dev/mingw/include/pixman-1 -ic:/dev/mingw/include -i/mingw32/include/freetype2 -i/mingw32/include/libpng16 -i/mingw32/include/harfbuzz -i/mingw32/include/glib-2.0 -i/mingw32/lib/glib-2.0/include -i/mingw32/include -ic:/dev/mingw/include/freetype2 -ic:/dev/mingw/include/libpng16 -ic:/dev/mingw/include/harfbuzz -wl,-luuid -lc:/dev/mingw/lib -lgtkmm-3.0 -latkmm-1.6 -lgdkmm-3.0 -lgiomm-2.4 -lpangomm-1.4 -lgtk-3 -lglibmm-2.4 -lcairomm-1.0 -lgdk-3 -lgdi32 -limm32 -lshell32 -lole32 -lwinmm -ldwmapi -lz -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lpango-1.0 -lcairo -lsigc-2.0 -lgobject-2.0 -lglib-2.0 -lintl -z lazy -std=c++11 -mms-bitfields -pthread -ic:/dev/mingw/include/glibmm-2.4 -ic:/dev/mingw/lib/glibmm-2.4/include -ic:/dev/mingw/include/sigc++-2.0 -ic:/dev/mingw/lib/sigc++-2.0/include -ic:/dev/mingw/include/glib-2.0 -ic:/dev/mingw/lib/glib-2.0/include -ic:/dev/mingw/include/gtkmm-3.0 -ic:/dev/mingw/lib/gtkmm-3.0/include -ic:/dev/mingw/include/atkmm-1.6 -ic:/dev/mingw/include/giomm-2.4 -ic:/dev/mingw/lib/giomm-2.4/include -ic:/dev/mingw/include/pangomm-1.4 -ic:/dev/mingw/lib/pangomm-1.4/include -ic:/dev/mingw/include/gtk-3.0 -ic:/dev/mingw/include/cairomm-1.0 -ic:/dev/mingw/lib/cairomm-1.0/include -ic:/dev/mingw/include/gdk-pixbuf-2.0 -ic:/dev/mingw/include/gdkmm-3.0 -ic:/dev/mingw/lib/gdkmm-3.0/include -ic:/dev/mingw/include/atk-1.0 -ic:/dev/mingw/include/pango-1.0 -ic:/dev/mingw/include/cairo -ic:/dev/mingw/include/pixman-1 -ic:/dev/mingw/include -i/mingw32/include/freetype2 -i/mingw32/include/libpng16 -i/mingw32/include/harfbuzz -i/mingw32/include/glib-2.0 -i/mingw32/lib/glib-2.0/include -i/mingw32/include -ic:/dev/mingw/include/freetype2 -ic:/dev/mingw/include/libpng16 -ic:/dev/mingw/include/harfbuzz -iinclude -ic:\dev\mingw\include -c "c:\documents , settings\jason\desktop\infiltrator\src\agentdatabase.cpp" -o obj\debug\src\agentdatabase.o  mingw32-g++-dw2.exe -lc:\dev\mingw\lib -o bin\debug\infiltrator.exe obj\debug\main.o obj\debug\src\agentdatabase.o obj\debug\src\agentwindow.o obj\debug\src\customwidgets.o obj\debug\src\fileencryption.o obj\debug\src\gamewindow.o obj\debug\src\infowindow.o obj\debug\src\keygen.o obj\debug\src\playerlist.o obj\debug\src\primarywindow.o obj\debug\src\setupwindow.o  -wl,-luuid -lc:/dev/mingw/lib -lgtkmm-3.0 -latkmm-1.6 -lgdkmm-3.0 -lgiomm-2.4 -lpangomm-1.4 -lgtk-3 -lglibmm-2.4 -lcairomm-1.0 -lgdk-3 -lgdi32 -limm32 -lshell32 -lole32 -lwinmm -ldwmapi -lz -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lpango-1.0 -lcairo -lsigc-2.0 -lgobject-2.0 -lglib-2.0 -lintl   -wl,-luuid -lc:/dev/mingw/lib -lgtkmm-3.0 -latkmm-1.6 -lgdkmm-3.0 -lgiomm-2.4 -lpangomm-1.4 -lgtk-3 -lglibmm-2.4 -lcairomm-1.0 -lgdk-3 -lgdi32 -limm32 -lshell32 -lole32 -lwinmm -ldwmapi -lz -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lpango-1.0 -lcairo -lsigc-2.0 -lgobject-2.0 -lglib-2.0 -lintl   -wl,-luuid -lc:/dev/mingw/lib -lgtkmm-3.0 -latkmm-1.6 -lgdkmm-3.0 -lgiomm-2.4 -lpangomm-1.4 -lgtk-3 -lglibmm-2.4 -lcairomm-1.0 -lgdk-3 -lgdi32 -limm32 -lshell32 -lole32 -lwinmm -ldwmapi -lz -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lpango-1.0 -lcairo -lsigc-2.0 -lgobject-2.0 -lglib-2.0 -lintl     c:/dev/mingwold/bin/../lib/gcc/mingw32/5.1.0-dw2/../../../../mingw32/bin/ld.exe: cannot find -ldwmapi c:/dev/mingwold/bin/../lib/gcc/mingw32/5.1.0-dw2/../../../../mingw32/bin/ld.exe: cannot find -ldwmapi c:/dev/mingwold/bin/../lib/gcc/mingw32/5.1.0-dw2/../../../../mingw32/bin/ld.exe: cannot find -ldwmapi collect2.exe: error: ld returned 1 exit status process terminated status 1 (1 minute(s), 42 second(s)) 3 error(s), 7 warning(s) (1 minute(s), 42 second(s)) 

lazy linking, -z lazy, gnu linker's default on unix-like systems , not supported in mingw windows ports. (this has nothing code::blocks)

i cannot fathom hope repose in lazy linking overcome problem, doesn't matter. if can't count on shared library available on target systems of project 1 customary course link library statically in executable. can here.

the 32-bit tdm gcc using not ship dwmapi in static library corresponding 64-bit toolchain ship both 64- , 32-bit builds of it, respectively:

<tdm-gcc-64-install-dir>/x86_64-w64-mingw32/lib/libdwmapi.a 

and

<tdm-gcc-64-install-dir>/x86_64-w64-mingw32/lib32/libdwmapi.a 

those paths among linker defaults toolchain, link library if mention -ldwmapi in linker options (as have done).

the absence of libdwmapi.a in 32-bit toolchain may anomaly, or may decision based on fact library not around until windows had transitioned 64-bit in mainstream.

you have 3 options then:

  1. if have no committment building 32-bit can swap corresponding 64-bit toolchain (and 64-bit libraries accross board)

  2. swap 64-bit toolchain continue build 32-bit adding option -m32 compiler , linker

  3. install 64-bit toolchain, continue using 32-bit toolchain, add -l<tdm-gcc-64-install-dir>/x86_64-w64-mingw32/lib32 linker search paths, after have specified.

a couple of unrelated observations:-

in , your previous question of g++ commandline options appear 3 times each! - yielding 4k commandlines make tiresome parsing. code::blocks ide, way in can have produced triplication setting of these options once in global settings -> compiler, again in overall project settings infiltrator -> build options -> infiltrator, , yet again in project debug/release configuration settings infiltrator -> build options -> infiltrator -> debug/release.

these 3 levels of settings form inheritance hierarchy. not make any project specific settings globally compiler. doing makes them properties of compiler , applied every other project build compiler. project settings invariant between project configurations (debug/release) should made once @ project level. debug , release options should set @ project configuration level.

lastly see have chosen install tdm-gcc-32 variant dwarf2 style exception handling, rather default package (per executable installer) setjump-longjump style exception handling. carries risk. while dw2 exception handling more efficient sjlj, foreign windows , fail if exception must propagate through windows library not built in same way. setjump-longjump mechamism, though slower, relies on primtive, long standardized c library facilities c or c++ compiler implements.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -