FTGL到处都是未定义的参考?

时间:2012-01-03 14:59:11

标签: c++ opengl codeblocks ftgl

我试图使用这个库在OpenGL应用程序上输出文本到目前为止,我有一个预编译的库,所以我更容易上手所以这个代码:

#include <SDL/SDL_opengl.h>
#include <FTGL/ftgl.h>
...
...
int main( int argc, char* args[] )
{
...
...

//Y U NO WORK!
FTGLPixmapFont font("ariblk.ttf");
if(font.Error())

...
...

 SDL_Quit();

 return 0;
 }

所以如果我用这个连接器编译它:
-lmingw32 -lSDLmain -lSDL -lopengl32 -lglu32 -lSDL_image -lm -lgdi32 -lsdl_mixer -lSDL_ttf

我收到了这个错误:

OPENGL ETC\SDLOPENGL\main.cpp|108|undefined reference to `FTPixmapFont::FTPixmapFont(char const*)'|

OPENGL ETC\SDLOPENGL\main.cpp|109|undefined reference to `FTFont::Error() const'|

OPENGL ETC\SDLOPENGL\main.cpp|303|undefined reference to `FTPixmapFont::~FTPixmapFont()'|

OPENGL ETC\SDLOPENGL\main.cpp|303|undefined reference to `FTPixmapFont::~FTPixmapFont()'|
||=== Build finished: 4 errors, 0 warnings ===|

现在这应该是因为如果我包含剩下的2个连接器,我忘了将链接器设置为IDK原因:

-lfreetype2 -lftgl

我得到了50个错误我不打算把它们放在这里我不想让你的眼睛睁开眼睛。

那么问题是我可以做些什么来解决这个问题呢?

IDE:CodeBlocks 操作系统:Windows

编辑:

因此,在更改订单后,我仍然会收到错误

错误:

||=== SDL, Debug ===|
int)]+0x12)||undefined reference to `glPushAttrib@4'|
int)]+0x21)||undefined reference to `glPushClientAttrib@4'|
int)]+0x30)||undefined reference to `glEnable@4'|
int)]+0x47)||undefined reference to `glBlendFunc@8'|
int)]+0x6c)||undefined reference to `glGetFloatv@8'|
int)]+0x82)||undefined reference to `glPixelTransferf@8'|
int)]+0x98)||undefined reference to `glPixelTransferf@8'|
int)]+0xae)||undefined reference to `glPixelTransferf@8'|
int)]+0xc4)||undefined reference to `glPixelTransferf@8'|
int)]+0x147)||undefined reference to `glPopClientAttrib@0'|
int)]+0x14c)||undefined reference to `glPopAttrib@0'|
int)]+0x12)||undefined reference to `glPushAttrib@4'|
int)]+0x21)||undefined reference to `glPushClientAttrib@4'|
int)]+0x30)||undefined reference to `glEnable@4'|
int)]+0x47)||undefined reference to `glBlendFunc@8'|
int)]+0x6c)||undefined reference to `glGetFloatv@8'|
int)]+0x82)||undefined reference to `glPixelTransferf@8'|
int)]+0x98)||undefined reference to `glPixelTransferf@8'|
int)]+0xae)||undefined reference to `glPixelTransferf@8'|
int)]+0xc4)||undefined reference to `glPixelTransferf@8'|
int)]+0x147)||undefined reference to `glPopClientAttrib@0'|
int)]+0x14c)||undefined reference to `glPopAttrib@0'|

c:\program     
files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libftgl.a
(FTPixmapGlyph.o):FTPixmapGlyph.cpp|| undefined reference to `glBitmap@28'|

c:\program   files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libftgl.a
(FTPixmapGlyph.o):FTPixmapGlyph.cpp|| undefined reference to `glPixelStorei@8'|

c:\program   files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libftgl.a
(FTPixmapGlyph.o):FTPixmapGlyph.cpp|| undefined reference to `glPixelStorei@8'|

c:\program  files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libftgl.a
(FTPixmapGlyph.o):FTPixmapGlyph.cpp|| undefined reference to `glDrawPixels@20'|

c:\program  files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libftgl.a
(FTPixmapGlyph.o):FTPixmapGlyph.cpp|| undefined reference to `glBitmap@28'|
||=== Build finished: 27 errors, 0 warnings ===|

编辑:

看起来好像在做了后来编码所说的错误仍然

之后,你们的答案就不会起作用了
||=== SDL, Debug ===|
c:\program    
files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libftgl.a
(FTPixmapGlyph.o):FTPixmapGlyph.cpp|| undefined reference to `FT_Render_Glyph'|

c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libftgl.a
(FTPixmapGlyph.o):FTPixmapGlyph.cpp|| undefined reference to `FT_Render_Glyph'|

c:\program       
files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libftgl.a
(FTFace.o):FTFace.cpp|| undefined reference to `FT_New_Face'|

c:\program   files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libftgl.a
(FTFace.o):FTFace.cpp|| undefined reference to `FT_New_Face'|

c:\program    files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libftgl.a
(FTFace.o):FTFace.cpp|| undefined reference to `FT_New_Memory_Face'|

c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libftgl.a
(FTFace.o):FTFace.cpp|| undefined reference to `FT_New_Memory_Face'|

c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libftgl.a
(FTFace.o):FTFace.cpp|| undefined reference to `FT_Done_Face'|

c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libftgl.a
(FTFace.o):FTFace.cpp|| undefined reference to `FT_Done_Face'|

c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libftgl.a
(FTFace.o):FTFace.cpp|| undefined reference to `FT_Done_Face'|

c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libftgl.a
(FTFace.o):FTFace.cpp|| undefined reference to `FT_Attach_File'|

c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libftgl.a
(FTFace.o):FTFace.cpp|| undefined reference to `FT_Attach_Stream'|

c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libftgl.a
(FTFace.o):FTFace.cpp|| undefined reference to `FT_Get_Kerning'|

c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libftgl.a
(FTFace.o):FTFace.cpp|| undefined reference to `FT_Load_Glyph'|

c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libftgl.a      
(FTFace.o):FTFace.cpp|| undefined reference to `FT_Get_Kerning'|

c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libftgl.a   
(FTSize.o):FTSize.cpp|| undefined reference to `FT_Set_Char_Size'|
)]+0x54)||undefined reference to `FT_Outline_Get_CBox'|

c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libftgl.a
(FTCharmap.o):FTCharmap.cpp|| undefined reference to `FT_Set_Charmap'|

c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libftgl.a
(FTCharmap.o):FTCharmap.cpp|| undefined reference to `FT_Get_Char_Index'|

c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libftgl.a
(FTCharmap.o):FTCharmap.cpp|| undefined reference to `FT_Set_Charmap'|

c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libftgl.a
(FTCharmap.o):FTCharmap.cpp|| undefined reference to `FT_Get_Char_Index'|

c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libftgl.a
(FTCharmap.o):FTCharmap.cpp|| undefined reference to `FT_Select_Charmap'|

c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libftgl.a
(FTCharmap.o):FTCharmap.cpp|| undefined reference to `FT_Get_Char_Index'|

c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libftgl.a
(FTLibrary.o):FTLibrary.cpp|| undefined reference to `FT_Done_FreeType'|

c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libftgl.a
(FTLibrary.o):FTLibrary.cpp|| undefined reference to `FT_Done_FreeType'|

c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libftgl.a
(FTLibrary.o):FTLibrary.cpp|| undefined reference to `FT_Init_FreeType'|
||=== Build finished: 25 errors, 0 warnings ===|

最后更新

正确的顺序是:

-lmingw32 -lSDLmain -lSDL -lSDL_image -lm -lgdi32 -lsdl_mixer -lSDL_ttf -lftgl -lfreetype2 -lopengl32 -lglu32

1 个答案:

答案 0 :(得分:2)

尝试在-lopengl32 -lglu32之后移动-lftgl。让我们知道会发生什么。

请查看此问题,了解有关您的问题以及将来如何解决问题的详细信息:

Why does the order in which libraries are linked sometimes cause errors in GCC?

相关问题