我收到以下错误。我自己无法解决。
错误消息:
interface.cpp:191:10: error: request for member 'FaceSize' in 'interface::font', which is of non-class type 'void*'
font.FaceSize(fontSize);
^
interface.cpp:202:18: error: request for member 'Render' in 'interface::font', which is of non-class type 'void*'
font.Render(todisplay);
^
interface.cpp:215:10: error: request for member 'Render' in 'interface::font', which is of non-class type 'void*'
font.Render(todisplay);
^
以下是错误来自的代码段:
#if defined(__APPLE__)
FTGLPixmapFont font("/Library/Fonts/Arial.ttf");
#elif defined(_WIN32) || defined(_WIN64) || defined(WINDOWS) || defined(MINGW) || defined(MINGW64)
FTGLPixmapFont font("C:\\Windows\\Fonts\\Arial.ttf");
#elif defined(__LINUX__)
FTGLPixmapFont
font("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf");
#endif
font.FaceSize(fontSize);
glPushMatrix();
for (float xCount = -borderWidth/2; xCount <= borderWidth/2; xCount++)
{
for (float yCount = -borderWidth/2; yCount <= borderWidth/2; yCount++)
{
glRasterPos3f(
x+xCount*fontscaleX,
y+yCount*fontscaleY,
INTERFACE_TEXT_SHADER_DEPTH
);
font.Render(todisplay);
}
}
glColor3f(foregroundRed, foregroundGreen, foregroundBlue);
glRasterPos3f(x, y, INTERFACE_TEXT_DEPTH);
font.Render(todisplay);
glPopMatrix();
此代码在OS X中完美构建,没有任何问题。但是当我尝试在ubuntu中构建时,它无法构建。我正在尝试使用图标脚本构建。以下是编译interface.cpp文件的命令:
g ++ -o interface.o -c -Wall -ansi -pedantic -O2 -lGL -lGLU -lX11 -std = c ++ 11 -DSETTINGS_DEVELOPMENT -DUSER_UMA -I / usr / include / mysql -I / opt / local / include -I / usr / include / boost / system -I / usr / include / boost -I / usr / include / boost / test -I / usr / include / boost / timer -I / opt / local / include / mariadb / mysql -I / usr / include / freetype2 -Irapidxml -Ilru_cache interface.cpp
答案 0 :(得分:0)
预处理器可能不会在您的情况下定义__linux__
。
根据GCC Manual和this answer,您可以通过运行来检查预定义的宏:
$ touch dummy.cpp
$ cpp -dM dummy.cpp