title: Compilation with GTK in Code::Blocks undefined reference to `gdk_cairo_create'
body: <p>After a serious system crash, I had to reinstall everything (Windows 10), including Code::Blocks (version 16.01) to develop my code using the GTK+2 library. I ended up with a strange situation that I can't solve. </p>
  
  <p>Some of my programs are compiling correctly, while others don't. Here is a copy of the build log output for an example that does not compile correctly:</p>
  
  <pre><code>mingw32-g++.exe -L"C:\Program Files (x86)\CodeBlocks\gtk\lib" -o bin\Debug\trajecto.exe obj\Debug\main.o   -lgtk-win32-2.0 -lgobject-2.0 -lglib-2.0 "C:\Program Files (x86)\CodeBlocks\gtk\lib\cairo.lib" "C:\Program Files (x86)\CodeBlocks\gtk\lib\libpangocairo-1.0.dll.a"
  obj\Debug\main.o: In function `on_expose_event_trajet':
  D:/calcul C/essai gtk/essai gtk/trajecto/main.c:804: undefined reference to `gdk_cairo_create'
  D:/calcul C/essai gtk/essai gtk/trajecto/main.c:805: undefined reference to `gdk_cairo_create'
  D:/calcul C/essai gtk/essai gtk/trajecto/main.c:806: undefined reference to `gdk_cairo_create'
  D:/calcul C/essai gtk/essai gtk/trajecto/main.c:807: undefined reference to `gdk_cairo_create'
  D:/calcul C/essai gtk/essai gtk/trajecto/main.c:890: undefined reference to `gdk_cairo_create'
  obj\Debug\main.o:D:/calcul C/essai gtk/essai gtk/trajecto/main.c:939: more undefined references to `gdk_cairo_create' follow
  collect2.exe: error: ld returned 1 exit status
  Process terminated with status 1 (0 minute(s), 0 second(s))
  7 error(s), 0 warning(s) (0 minute(s), 0 second(s))
  </code></pre>
  
  <p>And here is what I get for a program that compiles correctly (still using gdk_cairo_create()):</p>
  
  <pre><code>mingw32-gcc.exe -Wall -mms-bitfields -g -Wall -I"C:\Program Files (x86)\CodeBlocks\gtk\include" -I"C:\Program Files (x86)\CodeBlocks\gtk\include\gtk-2.0" -I"C:\Program Files (x86)\CodeBlocks\gtk\include\cairo" -I"C:\Program Files (x86)\CodeBlocks\gtk\include\gdk" -I"C:\Program Files (x86)\CodeBlocks\gtk\include\glib-2.0" -I"C:\Program Files (x86)\CodeBlocks\gtk\lib\glib-2.0\include" -I"C:\Program Files (x86)\CodeBlocks\gtk\include\pango-1.0" -I"C:\Program Files (x86)\CodeBlocks\gtk\lib\gtk-2.0\include" -I"C:\Program Files (x86)\CodeBlocks\gtk\include\atk-1.0" -I"C:\Program Files (x86)\CodeBlocks\gtk\include\gdk-pixbuf-2.0" -c "D:\calcul C\essai gtk\essai gtk\Michal\main.c" -o obj\Debug\main.o
  mingw32-g++.exe -L"C:\Program Files (x86)\CodeBlocks\gtk\lib" -o bin\Debug\ehpad.exe obj\Debug\main.o   -lgtk-win32-2.0 -lgobject-2.0 -lglib-2.0 "C:\Program Files (x86)\CodeBlocks\gtk\lib\pango-1.0.lib" "C:\Program Files (x86)\CodeBlocks\gtk\lib\gdk-win32-2.0.lib" "C:\Program Files (x86)\CodeBlocks\gtk\lib\cairo.lib" "C:\Program Files (x86)\CodeBlocks\gtk\lib\libpangocairo-1.0.dll.a"
  Output file is bin\Debug\ehpad.exe with size 69.91 KB
  Process terminated with status 0 (0 minute(s), 1 second(s))
  0 error(s), 0 warning(s) (0 minute(s), 1 second(s))
  </code></pre>
  
  <p>There are differences but how can I know (and understand) where is the problem? I've tried a lot of different things. The libraries included in the linker options are the same for both on these examples (cairo.lib and libpangocairo-1.0.dll.a).</p>
  
  <p>I've found in different places on the web that the order of arguments on the compilation line can matter, but I do not see in Code::Blocks how this can be changed.</p>
  
  <p>This is driving me crazy, and I would be very thankful if someone can give me a hint on that.</p>
  
  <p>Thanks in advance and cheers, Eric.</p>