当我编译我的opengl代码时,我正面临这个错误。如何删除它?
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内容 和我的渲染字体的代码
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);
答案 0 :(得分:0)
查找FTExtrudeFont它似乎是ftgl库中的一个函数 http://ftgl.sourceforge.net/docs/html/classFTExtrudeFont.html 但是你没有链接那个库。所以你可能需要-lftgl(假设它是库的名称)。
根据库的安装位置(或者您是否自己构建了它),您可能还需要使用-L标志告诉链接器在哪里查找库,即您的编译行将类似于
g++ -o sample2D Sample_GL3_2D.cpp glad.c -L <path-to-dir-with-ftgl-library> -lftgl -lglfw -lGL -ldl -std=c++11