Re: Tripping on first step - cannot compile "hello world" with Cairo on Mingwenv

Dimiter 'malkia' Stanev <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
Try adding -mconsole to the mingw compiler, as you have main() instead 
of WinMain()

I haven't used much it, so I could be wrong, I was just digging through 
some options (this is from the cygwin shell, invoking it's own mingw 
compiler, but they should be close to yours)

dstanev@dstanev-764 ~
$ i686-w64-mingw32-gcc --help -v -v 2>&1 | grep WinMain

dstanev@dstanev-764 ~
$ i686-w64-mingw32-gcc --help -v -v 2>&1 | grep -i main
   -F <dir>                    Add <dir> to the end of the main framework
   -I <dir>                    Add <dir> to the end of the main include path
   -Wmain                      Warn about suspicious declarations of "main"
   -Wunused-macros             Warn about macros defined in the main 
file that
                               "main" exist
   -iwithprefixbefore <dir>    Add <dir> to the end of the main include path

dstanev@dstanev-764 ~
$ i686-w64-mingw32-gcc --help -v -v 2>&1 | grep -i windows
   -mwin32                     Set Windows defines
   -mwindows                   Create GUI application

dstanev@dstanev-764 ~
$ i686-w64-mingw32-gcc --help -v -v 2>&1 | grep -i console
   -mconsole                   Create console application


On 3/8/2012 11:22 AM, mathog wrote:
> On 08-Mar-2012 10:49, Chris Wilson wrote:
>
>> 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.
>
> I thought that was just for static libraries, dynamic shouldn't matter.
> In any case, rewrote it as:
>
> mingw32-gcc -c -o test.obj -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 test.c
>
> mingw32-gcc -o test test.obj -mms-bitfields -Lc:/progs/devlibs2/lib
> -Lc:/progs/mingw/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
>
> but it still emits:
>
> c:/progs/mingw/lib/libmingw32.a(main.o):main.c:(.text+0xd2): undefined
> reference to `WinMain@16'
> collect2: ld returned 1 exit status
>
> It does that even if the entire set of -l options is repeated again.
> Maybe the the cairo example needs something
> else to build on Windows, like some ifdef to cause it to include a WinMain?
>
> Thanks,
>
>
> David Mathog
> [email protected]
> Manager, Sequence Analysis Facility, Biology Division, Caltech
> --
> cairo mailing list
> [email protected]
> http://lists.cairographics.org/mailman/listinfo/cairo
>
--
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.