[cairo] Tripping on first step - cannot compile "hello world" with Cairo on Mingwenv

Chris Wilson chris at chris-wilson.co.uk
Thu Mar 8 10:49:50 PST 2012


On Thu, 08 Mar 2012 10:39:39 -0800, mathog <mathog at caltech.edu> wrote:
> On 08-Mar-2012 10:13, mathog wrote:
> 
> Correction hat should have been mingw environment, not mingwenv.
> 
> > Then run the command:
> >
> > gcc -o test -mms-bitfields -Ic:/progs/devlibs2/include/gtk-2.0
> > -Ic:/progs/devlibs2/lib/gtk-2.0/include
> > -Ic:/progs/devlibs2/include/atk-1.0 -Ic:/progs/devlibs2/include/cairo
> > -Ic:/progs/devlibs2/include/gdk-pixbuf-2.0
> > -Ic:/progs/devlibs2/include/pango-1.0
> > -Ic:/progs/devlibs2/include/glib-2.0
> > -Ic:/progs/devlibs2/lib/glib-2.0/include
> > -Ic:/progs/devlibs2/include/pixman-1 -Ic:/progs/devlibs2/include
> > -Ic:/progs/devlibs2/include/freetype2
> > -Ic:/progs/devlibs2/include/libpng12  -Lc:/progs/devlibs2/lib
> > -lgtk-win32-2.0 -lgdk-win32-2.0 -latk-1.0 -lgio-2.0 -lpangowin32-1.0
> > -lgdi32 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lpango-1.0 -lcairo
> > -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -lintl test.c
> 
> changing the last part to
> 
> -lintl test.c c:/progs/devlibs2/lib/libcairo.dll.a 
> c:/progs/devlibs2/lib/libgdk-win32-2.0.dll.a
> 
> got rid of all of the messages except:
> 
> > 
> > c:/progs/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../libmingw32.a(main.o):main.c:(.text+0xd2):
> > undefined reference to `WinMain at 16'
> > collect2: ld returned 1 exit status
> 
> I don't see why these had to be added explicitly, as 
> -Lc:/progs/devlibs2/lib was present, as was the
> -l for each.

During linking, the order is important: symbols are resolved to the
right. That is test.c will look up its symbols in libcairo.dll.a then
libgdk-win32-2.0.dll.a and libcairo.dll.a will lookup its symbols in
libgdk-win32-2.0.dll.a etc.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the cairo mailing list