Question

I'm trying an experiment with waf (the build system) on mupdf.

I've encountered a compiler error when compiling mupdf\fitz\dev_gdiplus.cpp.

..\..\..\mupdf\fitz\dev_gdiplus.cpp:1170:12: error: invalid use of 'static' in linkage specification

 extern "C" static void

The offending code (this is one instance; there are many):

extern "C" static void
fz_gdiplus_fill_path(fz_device *dev, fz_path *path, int evenodd, const fz_matrix *ctm,
    fz_colorspace *colorspace, float *color, float alpha)
{
    GraphicsPath *gpath = gdiplus_get_path(path, ctm, false, evenodd);
    Brush *brush = gdiplus_get_brush(dev, colorspace, color, alpha);

    ((userData *)dev->user)->started = true;
    ((userData *)dev->user)->graphics->FillPath(brush, gpath);

    delete brush;
    delete gpath;
}

This was the compiler call:

['C:\\MinGW64\\mingw64\\bin\\g++.exe', '-fpermissive', '-IC:\\Users\\Administrator\\Downloads\\SumatraPDF-2.3.2-source\\sumatrapdf-2.3.2\\build\\temp\\debug\\mupdf\\fitz', '-IC:\\Users\\Administrator\\Downloads\\SumatraPDF-2.3.2-source\\sumatrapdf-2.3.2\\mupdf\\fitz', '-IC:\\Users\\Administrator\\Downloads\\SumatraPDF-2.3.2-source\\sumatrapdf-2.3.2\\build\\temp\\debug\\mupdf', '-IC:\\Users\\Administrator\\Downloads\\SumatraPDF-2.3.2-source\\sumatrapdf-2.3.2\\mupdf', '-IC:\\Users\\Administrator\\Downloads\\SumatraPDF-2.3.2-source\\sumatrapdf-2.3.2\\build\\temp\\debug\\mupdf\\pdf', '-IC:\\Users\\Administrator\\Downloads\\SumatraPDF-2.3.2-source\\sumatrapdf-2.3.2\\mupdf\\pdf', '-IC:\\Users\\Administrator\\Downloads\\SumatraPDF-2.3.2-source\\sumatrapdf-2.3.2\\build\\temp\\debug\\mupdf\\xps', '-IC:\\Users\\Administrator\\Downloads\\SumatraPDF-2.3.2-source\\sumatrapdf-2.3.2\\mupdf\\xps', '-IC:\\Users\\Administrator\\Downloads\\SumatraPDF-2.3.2-source\\sumatrapdf-2.3.2\\build\\temp\\debug\\ext\\freetype2\\include', '-IC:\\Users\\Administrator\\Downloads\\SumatraPDF-2.3.2-source\\sumatrapdf-2.3.2\\ext\\freetype2\\include', '-IC:\\Users\\Administrator\\Downloads\\SumatraPDF-2.3.2-source\\sumatrapdf-2.3.2\\build\\temp\\debug\\ext\\jbig2dec', '-IC:\\Users\\Administrator\\Downloads\\SumatraPDF-2.3.2-source\\sumatrapdf-2.3.2\\ext\\jbig2dec', '-IC:\\Users\\Administrator\\Downloads\\SumatraPDF-2.3.2-source\\sumatrapdf-2.3.2\\build\\temp\\debug\\ext\\libjpeg-turbo', '-IC:\\Users\\Administrator\\Downloads\\SumatraPDF-2.3.2-source\\sumatrapdf-2.3.2\\ext\\libjpeg-turbo', '-IC:\\Users\\Administrator\\Downloads\\SumatraPDF-2.3.2-source\\sumatrapdf-2.3.2\\build\\temp\\debug\\ext\\openjpeg', '-IC:\\Users\\Administrator\\Downloads\\SumatraPDF-2.3.2-source\\sumatrapdf-2.3.2\\ext\\openjpeg', '-DWAF=1', '-DVERSION="0.1"', '-DINLINE_MACRO=1', '-DHAVE_STDINT_H=1', '-DHAVE_STRING_H=1', '-DHAVE_STDIO_H=1', '-DDEBUG=1', '..\\..\\..\\mupdf\\fitz\\dev_gdiplus.cpp', '-c', '-o', 'mupdf\\fitz\\dev_gdiplus.cpp.1.o']

I suspect this is something to do with gcc, rather than the code. What's wrong with the code? What switches/flags need to be given to gcc to resolve the issue?

I'm using gcc (rev3, Built by MinGW-builds project) 4.8.1, on Windows 7 64bit.

Disclaimer: I don't understand c++.

Was it helpful?

Solution

I can duplicate the error with the following:

extern "C" static void f()
{
}

I can resolve the error by slightly changing the code to:

extern "C"
{
    static void f()
    {
    }
}

Seems like the compiler should be a little smarter here but at least it can be worked around.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top