Undefined Reference to GetThemeBackgroundContentRect

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
Lowkus
Experienced Solver
Experienced Solver
Posts: 61
Joined: Sun May 01, 2016 2:48 am

Undefined Reference to GetThemeBackgroundContentRect

Post by Lowkus »

I'm trying to get my project running (running CodeBlocks on Win10 with GCC compiler), but it's throwing this error (one of many):

C:\wxWidgets\wxWidgets-3.1.5\lib\gcc_lib\libwxmsw31u_core.a(corelib_window.o):window.cpp|| undefined reference to `__imp_GetThemeBackgroundContentRect'

I'm pretty sure I have made a mess of the project settings. Here are my build options for the search directories, how should I clean these up? Or would the problem be in the compiler settings or linker settings?

Search directories (compiler):
  • $(#wx.include)
  • $(#wx.lib)\gcc_lib\mswud
  • include
  • $(wx.include)\wx\msw
Search directories (linker):
  • resources
  • $(#wx.lib)\gcc_lib
  • $(#wx.lib)\gcc_dll
I originally compiled wxWidgets using this command using the same compiler that I'm using to build the project:
mingw32-make -f makefile.gcc SHARED=0 UNICODE=1 BUILD=debug clean
mingw32-make -f makefile.gcc SHARED=0 UNICODE=1 BUILD=debug


And here what shows up in the build log before the failure occurs:
g++.exe -Lresources -LC:\wxWidgets\wxWidgets-3.1.5\lib\gcc_lib -LC:\wxWidgets\wxWidgets-3.1.5\lib\gcc_dll -o bin\Release\CShp.exe obj\Release\src\frmMain.o obj\Release\resource.res -s -mthreads -lwxmsw31u_core -lwxbase31u -lwxpng -lwxzlib -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lcomctl32 -lwsock32 -lodbc32 -lshlwapi -lversion -loleacc C:\wxWidgets\wxWidgets-3.1.5\lib\gcc_lib\libwxjpeg.a C:\wxWidgets\wxWidgets-3.1.5\lib\gcc_lib\libwxtiff.a -mwindows
New Pagodi
Super wx Problem Solver
Super wx Problem Solver
Posts: 465
Joined: Tue Jun 20, 2006 6:47 pm
Contact:

Re: Undefined Reference to GetThemeBackgroundContentRect

Post by New Pagodi »

You need to add uxtheme.lib to the link libraries. I thought codeblocks added this to the wizard, but maybe that hasn't been done yet.

Usually with errors like this you can google the function name to find the missing library. In this case, googling will bring up this page and at the bottom you can see:
Library UxTheme.lib
which tells you the library that is needed for that particular function.
Post Reply