Using Cairo on windows


#1

Hi all,

I’m porting a project to windows and I can’t compile due to linking errors related to Cairo and libpng.

here they are:
1>cairo-static.lib(pixman-region16.obj) : error LNK2001: unresolved external symbol ___iob_func
1>libpng.lib(pngerror.obj) : error LNK2001: unresolved external symbol ___iob_func
1>cairo-static.lib(cairo-win32-surface.obj) : error LNK2001: unresolved external symbol ___iob_func
1>cairo-static.lib(cairo-boxes.obj) : error LNK2001: unresolved external symbol ___iob_func
1>cairo-static.lib(pixman-region32.obj) : error LNK2001: unresolved external symbol ___iob_func
1>cairo-static.lib(pixman-utils.obj) : error LNK2001: unresolved external symbol ___iob_func
1>C:\Users\henrique\Documents\Cinder_0.9.1\samples\CairoBasic\vc2013\Debug\CairoBasic.exe : fatal error LNK1120: 1 unresolved externals

the errors are the same described in this topic:

But I can’t find the solution described by @ryanbartley ( the install.bat ). Did anyone managed to solve this problem?

btw, I’m using VC2015.
thanks


#2

Are you using vc140 (compiler that ships with VS 2015)? I just tried with vc120 and GoodNightMorning sample worked as expected.


#3

yeap,
Do I need to rebuild libpng & cairo, for vc140? Or do you think it’s just easier to download visual studio 2013 and use vc120?

thanks!


#4

I’ve been installing both VS 2013 and 2015, then I run the vc120 compiler from within VS 2015, without upgrading the projects. This is just temporary, as we’ll be switching to vc140 throughout at the beginning of the next release cycle and you’ll no longer need to install VS 2013.


#5

cool!

thank you for the infos =)

bye


#7

Any plan to add VS2017 support?
I compile and run with vc141, and go the similar error as described at the beginning of the post.


#8

I think the Cairo libraries are built with toolset v140 (Visual Studio 2015). If you need support for Visual Studio 2017, probably the fastest way is to compile the Cairo libraries yourself.


#9

You can make the linking error go away with a newer build of the Cairo lib or just paste this in:

FILE _iob[] = { *stdin, *stdout, *stderr };
extern “C” FILE * __cdecl __iob_func(void) { return _iob; }

Put it after the includes before the App class in all the samples that use Cairo.