-1

I get the following errors. I could not solve it by myself.

The error message:

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);
      ^

The following is the code snippet where the errors come from:

#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();

This code is building perfectly in OS X with out any issues. But when I try to build in ubuntu it fails to build. I am trying to build using icons script. Following is the command to compile the interface.cpp file:

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

rocambille
  • 15,398
  • 12
  • 50
  • 68
Kid
  • 169
  • 1
  • 19
  • I *think* it should be `__linux__` and that, since `__LINUX__` isn't defined, you're picking up a global `font` of type `void*` from somewhere. I would stick an `#else error "Unsupported platform"` in there to make sure. – molbdnilo Oct 24 '16 at 10:49
  • hi molbdnilo thanks for the reply. No I tried both linux as well but it dint work. It works with unix now. But I don’t know why – Kid Oct 24 '16 at 10:57

1 Answers1

0

The preprocessor may not define __linux__ in your case.

According to the GCC Manual and also this answer you can check which macros are predefined by running:

$ touch dummy.cpp
$ cpp -dM dummy.cpp
Community
  • 1
  • 1
user7023624
  • 571
  • 5
  • 14