我試圖用這個庫輸出文本在OpenGL應用程序到目前爲止,我得到了一個prcompiled庫,所以我上手所以它會更容易這樣的代碼:FTGL未定義的參考文獻?
#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 ===|
現在,這應該是因爲我忘了把接頭右IDK原因,如果我包括2 REM癌寧接頭:
-lfreetype2 -lftgl
我得到這樣的錯誤50 Im不去把它們放在這裏我不想打破你的眼睛的傢伙。
那麼可能是什麼問題我可以做什麼來解決這個問題?
IDE:代碼塊 操作系統:Windows
編輯:
所以切換順序我仍然得到錯誤
錯誤後:
||=== SDL, Debug ===|
int)]+0x12)||undefined reference to `[email protected]'|
int)]+0x21)||undefined reference to `[email protected]'|
int)]+0x30)||undefined reference to `[email protected]'|
int)]+0x47)||undefined reference to `[email protected]'|
int)]+0x6c)||undefined reference to `[email protected]'|
int)]+0x82)||undefined reference to `[email protected]'|
int)]+0x98)||undefined reference to `[email protected]'|
int)]+0xae)||undefined reference to `[email protected]'|
int)]+0xc4)||undefined reference to `[email protected]'|
int)]+0x147)||undefined reference to `[email protected]'|
int)]+0x14c)||undefined reference to `[email protected]'|
int)]+0x12)||undefined reference to `[email protected]'|
int)]+0x21)||undefined reference to `[email protected]'|
int)]+0x30)||undefined reference to `[email protected]'|
int)]+0x47)||undefined reference to `[email protected]'|
int)]+0x6c)||undefined reference to `[email protected]'|
int)]+0x82)||undefined reference to `[email protected]'|
int)]+0x98)||undefined reference to `[email protected]'|
int)]+0xae)||undefined reference to `[email protected]'|
int)]+0xc4)||undefined reference to `[email protected]'|
int)]+0x147)||undefined reference to `[email protected]'|
int)]+0x14c)||undefined reference to `[email protected]'|
c:\program
files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libftgl.a
(FTPixmapGlyph.o):FTPixmapGlyph.cpp|| undefined reference to `[email protected]'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libftgl.a
(FTPixmapGlyph.o):FTPixmapGlyph.cpp|| undefined reference to `[email protected]'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libftgl.a
(FTPixmapGlyph.o):FTPixmapGlyph.cpp|| undefined reference to `[email protected]'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libftgl.a
(FTPixmapGlyph.o):FTPixmapGlyph.cpp|| undefined reference to `[email protected]'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libftgl.a
(FTPixmapGlyph.o):FTPixmapGlyph.cpp|| undefined reference to `[email protected]'|
||=== Build finished: 27 errors, 0 warnings ===|
編輯:
好像它不會爲你的答案工作WERS現在做什麼casualcoder說錯誤仍然
||=== 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
你應該附上您鏈接到的'freetype2'因爲你已經理所當然地推導出後得到的錯誤第一組錯誤是鏈接錯誤,因爲您沒有鏈接到'freetype2' – 2012-01-03 15:06:07
您必須鏈接ftgl庫。如果使用-lftgl -lfreetype2而不是您使用的順序會發生什麼情況。如果不起作用,請輸出5行輸出。 – casualcoder 2012-01-03 15:08:58
parapura是對的。僅僅因爲第二組錯誤並不意味着它們不是你的_real_問題。 – 2012-01-03 15:32:40