错误未定义对`FTExtrudeFont :: FTExtrudeFont(char const *)的引用 [英] error undefined reference to `FTExtrudeFont::FTExtrudeFont(char const*)'

查看:125
本文介绍了错误未定义对`FTExtrudeFont :: FTExtrudeFont(char const *)的引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在编译我的opengl代码时,我遇到此错误.如何删除此错误?

while I am compiling my opengl code I am facing this error.how to remove this?

all: sample2D

sample2D: Sample_GL3_2D.cpp glad.c
        g++ -o sample2D Sample_GL3_2D.cpp glad.c -lGL -lglfw -ldl -std=c++11

clean:
        rm sample2D

这是我的Makefile内容 还有我的字体渲染代码

this is my contents of Makefile and my code for rendering the font

const char* fontfile = "Monaco.ttf";
GL3Font.font = new FTExtrudeFont(fontfile); // 3D extrude style rendering

if(GL3Font.font->Error())
{
    cout << "Error: Could not load font `" << fontfile << "'" << endl;
    glfwTerminate();
    exit(EXIT_FAILURE);
}

// Create and compile our GLSL program from the font shaders
fontProgramID = LoadShaders( "fontrender.vert", "fontrender.frag" );
GLint fontVertexCoordAttrib, fontVertexNormalAttrib, fontVertexOffsetUniform;
fontVertexCoordAttrib = glGetAttribLocation(fontProgramID, "vertexPosition");
fontVertexNormalAttrib = glGetAttribLocation(fontProgramID, "vertexNormal");
fontVertexOffsetUniform = glGetUniformLocation(fontProgramID, "pen");
GL3Font.fontMatrixID = glGetUniformLocation(fontProgramID, "MVP");
GL3Font.fontColorID = glGetUniformLocation(fontProgramID, "fontColor");

GL3Font.font->ShaderLocations(fontVertexCoordAttrib, fontVertexNormalAttrib, fontVertexOffsetUniform);
GL3Font.font->FaceSize(1);
GL3Font.font->Depth(0);
GL3Font.font->Outset(0, 0);
GL3Font.font->CharMap(ft_encoding_unicode);

推荐答案

查找FTExtrudeFont,它似乎是ftgl库中的函数 http://ftgl.sourceforge.net/docs/html/classFTExtrudeFont.html 但是,您没有链接该库.因此,您可能需要-lftgl(假设这是该库的名称).

Looking up FTExtrudeFont it seems to be a function in the ftgl library http://ftgl.sourceforge.net/docs/html/classFTExtrudeFont.html however you are not linking that library. So you probably need -lftgl (assuming that is the named of the library).

根据库的安装位置(或者您自己构建的库),您还可能需要使用-L标志告诉链接器在哪里寻找库,即您的编译行将类似于

Depending on where the library is installed (or if you have just built it yourself) then you may also need to tell the linker where to look for the library using the -L flag i.e. your compile line will be something like

g++ -o sample2D Sample_GL3_2D.cpp glad.c -L <path-to-dir-with-ftgl-library> -lftgl -lglfw -lGL -ldl -std=c++11

这篇关于错误未定义对`FTExtrudeFont :: FTExtrudeFont(char const *)的引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆