编译mupdf\fitz\dev_gdiplus.cpp时遇到编译器错误。
..\..\..\mupdf\fitz\dev_gdiplus.cpp:1170:12: error: invalid use of 'static' in linkage specification
extern "C" static void
违规代码(这是一个实例;有很多):
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;
}
这是编译器调用:
['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']
我怀疑这与gcc有关,而不是代码。 代码有什么问题?需要向gcc提供哪些开关/标志才能解决问题?
我在Windows 7 64位上使用gcc(rev3,由MinGW-builds项目构建)4.8.1。
免责声明:我不懂c ++。
答案 0 :(得分:3)
我可以使用以下内容复制错误:
extern "C" static void f()
{
}
我可以通过稍微更改代码来解决错误:
extern "C"
{
static void f()
{
}
}
似乎编译器在这里应该更聪明,但至少它可以解决。