FTGL undefined references everywere?

£可爱£侵袭症+ 提交于 2019-12-25 03:36:11

问题


I was trying to use this library to output text on a OpenGL application so far I got a prcompiled library so it would be easier to me to get started so this the code:

#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;
 }

So if I do compile it with this linkers:
-lmingw32 -lSDLmain -lSDL -lopengl32 -lglu32 -lSDL_image -lm -lgdi32 -lsdl_mixer -lSDL_ttf

I get this errors:

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 ===|

Now this should be cause I forgot to put linkers right IDK cause if I include the 2 remaining linkers:

-lfreetype2 -lftgl

I get like 50 of errors Im not going to put them here I dont want to broke your eyes guys.

So what could be the problem what can I do for fixing this?

IDE: CodeBlocks OS: Windows

EDIT:

So after changing order I still get errors

Errors:

||=== 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 ===|

EDIT:

Seems like it will not work thx guys for your answers now after doing what casualcoder said errors still

||=== 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 ===|

LAST UPDATE

The right order was:

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


回答1:


Try moving -lopengl32 -lglu32 after -lftgl. Let us know what happens.

Look at this question for more details on your problem and how to solve it in future:

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



来源:https://stackoverflow.com/questions/8714155/ftgl-undefined-references-everywere

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!