# [texworks] Compilationerror for Mingw and printing

Stefan Löffler st.loeffler at gmail.com
Mon Jun 22 07:11:04 CEST 2009

```Hi,

On 2009-06-21 22:30, Alain Delmotte wrote:
> Stefan Löffler a écrit :
>> But we've passed compilation and are at linking now. That's progress
>> after all :).
>> My first guess would be that you somehow removed the
>>    LIBS +=lgdi32
>>    LIBS +=lole32
>> lines again, at least I don't see them in the command line.
> The lines were missing, they disappeared during trials. But following
> your comment I went to MinGW\lib and there was no gdi32 nor ole32, but
> "libgdi32.a" and "libole32.a"

That's alright.

> So I changed TeXworks.pro lines to
>    LIBS += -libgdi32   and
>    LIBS += -libole32

That's not ;). There are a few points that are wrong here:
linker that whatever is following is a library to link (as opposed to
e.g. "-L" which tells it that what follows is a directory in which to
look for libraries).
2) the "lib" prefix is added automatically if you don't specify a
complete filename, so if you specify "gdi32" the linker actually looks
for "libgdi32.a" (and possibly other variations for dynamically linked
libs, etc.)
3) If you specify the whole filename (including the "lib" prefix)
explicitly, I think you must also give the extension.
So each of the following lines should work:
LIBS += -lgdi32
LIBS += -llibgdi32.a
The first one is better in any case because it leaves finding the actual
filename to the linker. So unless it accidentally picks the wrong one
it's more portable.

> So I deleted the 2 lines and commented the #if ... #endif (in
> PDFDocument.cpp) and it compiled and it works for printing the source
> (keeping the highlighting colors) and creating the image for the PDF
> (printing to pdfcreator also works -- to print only one page you have
> to enter 2-2 not only 2).

I noticed that source highlighting no longer works if you print a
selection. But this may also be a Linux-specific issue.
Normally, you should be able to use all the normal notations (with the
exception of e.g. "1-2,5,9" which isn't supported by Qt; btw: could you
check if that prints just the pages 1-2 or all pages 1-9?)