FTGL到处都是未定义的引用
FTGL undefined references everywere?
我试图使用这个库在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 ETCSDLOPENGLmain.cpp|108|undefined reference to `FTPixmapFont::FTPixmapFont(char const*)'|
OPENGL ETCSDLOPENGLmain.cpp|109|undefined reference to `FTFont::Error() const'|
OPENGL ETCSDLOPENGLmain.cpp|303|undefined reference to `FTPixmapFont::~FTPixmapFont()'|
OPENGL ETCSDLOPENGLmain.cpp|303|undefined reference to `FTPixmapFont::~FTPixmapFont()'|
||=== Build finished: 4 errors, 0 warnings ===|
现在这应该是因为我忘记把链接器放在右边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
filescodeblocksmingwbin..libgccmingw324.4.1......libftgl.a
(FTPixmapGlyph.o):FTPixmapGlyph.cpp|| undefined reference to `glBitmap@28'|
c:program filescodeblocksmingwbin..libgccmingw324.4.1......libftgl.a
(FTPixmapGlyph.o):FTPixmapGlyph.cpp|| undefined reference to `glPixelStorei@8'|
c:program filescodeblocksmingwbin..libgccmingw324.4.1......libftgl.a
(FTPixmapGlyph.o):FTPixmapGlyph.cpp|| undefined reference to `glPixelStorei@8'|
c:program filescodeblocksmingwbin..libgccmingw324.4.1......libftgl.a
(FTPixmapGlyph.o):FTPixmapGlyph.cpp|| undefined reference to `glDrawPixels@20'|
c:program filescodeblocksmingwbin..libgccmingw324.4.1......libftgl.a
(FTPixmapGlyph.o):FTPixmapGlyph.cpp|| undefined reference to `glBitmap@28'|
||=== Build finished: 27 errors, 0 warnings ===|
编辑:在做了casualcoder说的错误之后,似乎不会为你的答案工作了。
||=== SDL, Debug ===|
c:program
filescodeblocksmingwbin..libgccmingw324.4.1......libftgl.a
(FTPixmapGlyph.o):FTPixmapGlyph.cpp|| undefined reference to `FT_Render_Glyph'|
c:program filescodeblocksmingwbin..libgccmingw324.4.1......libftgl.a
(FTPixmapGlyph.o):FTPixmapGlyph.cpp|| undefined reference to `FT_Render_Glyph'|
c:program
filescodeblocksmingwbin..libgccmingw324.4.1......libftgl.a
(FTFace.o):FTFace.cpp|| undefined reference to `FT_New_Face'|
c:program filescodeblocksmingwbin..libgccmingw324.4.1......libftgl.a
(FTFace.o):FTFace.cpp|| undefined reference to `FT_New_Face'|
c:program filescodeblocksmingwbin..libgccmingw324.4.1......libftgl.a
(FTFace.o):FTFace.cpp|| undefined reference to `FT_New_Memory_Face'|
c:program filescodeblocksmingwbin..libgccmingw324.4.1......libftgl.a
(FTFace.o):FTFace.cpp|| undefined reference to `FT_New_Memory_Face'|
c:program filescodeblocksmingwbin..libgccmingw324.4.1......libftgl.a
(FTFace.o):FTFace.cpp|| undefined reference to `FT_Done_Face'|
c:program filescodeblocksmingwbin..libgccmingw324.4.1......libftgl.a
(FTFace.o):FTFace.cpp|| undefined reference to `FT_Done_Face'|
c:program filescodeblocksmingwbin..libgccmingw324.4.1......libftgl.a
(FTFace.o):FTFace.cpp|| undefined reference to `FT_Done_Face'|
c:program filescodeblocksmingwbin..libgccmingw324.4.1......libftgl.a
(FTFace.o):FTFace.cpp|| undefined reference to `FT_Attach_File'|
c:program filescodeblocksmingwbin..libgccmingw324.4.1......libftgl.a
(FTFace.o):FTFace.cpp|| undefined reference to `FT_Attach_Stream'|
c:program filescodeblocksmingwbin..libgccmingw324.4.1......libftgl.a
(FTFace.o):FTFace.cpp|| undefined reference to `FT_Get_Kerning'|
c:program filescodeblocksmingwbin..libgccmingw324.4.1......libftgl.a
(FTFace.o):FTFace.cpp|| undefined reference to `FT_Load_Glyph'|
c:program filescodeblocksmingwbin..libgccmingw324.4.1......libftgl.a
(FTFace.o):FTFace.cpp|| undefined reference to `FT_Get_Kerning'|
c:program filescodeblocksmingwbin..libgccmingw324.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 filescodeblocksmingwbin..libgccmingw324.4.1......libftgl.a
(FTCharmap.o):FTCharmap.cpp|| undefined reference to `FT_Set_Charmap'|
c:program filescodeblocksmingwbin..libgccmingw324.4.1......libftgl.a
(FTCharmap.o):FTCharmap.cpp|| undefined reference to `FT_Get_Char_Index'|
c:program filescodeblocksmingwbin..libgccmingw324.4.1......libftgl.a
(FTCharmap.o):FTCharmap.cpp|| undefined reference to `FT_Set_Charmap'|
c:program filescodeblocksmingwbin..libgccmingw324.4.1......libftgl.a
(FTCharmap.o):FTCharmap.cpp|| undefined reference to `FT_Get_Char_Index'|
c:program filescodeblocksmingwbin..libgccmingw324.4.1......libftgl.a
(FTCharmap.o):FTCharmap.cpp|| undefined reference to `FT_Select_Charmap'|
c:program filescodeblocksmingwbin..libgccmingw324.4.1......libftgl.a
(FTCharmap.o):FTCharmap.cpp|| undefined reference to `FT_Get_Char_Index'|
c:program filescodeblocksmingwbin..libgccmingw324.4.1......libftgl.a
(FTLibrary.o):FTLibrary.cpp|| undefined reference to `FT_Done_FreeType'|
c:program filescodeblocksmingwbin..libgccmingw324.4.1......libftgl.a
(FTLibrary.o):FTLibrary.cpp|| undefined reference to `FT_Done_FreeType'|
c:program filescodeblocksmingwbin..libgccmingw324.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
尝试将-lopengl32 -lglu32
移到-lftgl
之后。让我们知道发生了什么。
看看这个问题,了解更多关于你的问题的细节,以及将来如何解决它:
为什么在GCC中库的链接顺序有时会导致错误?
相关文章:
- 对C宏的未定义引用,但在定义它时会出现重新定义错误
- 编译时的 CImg 库返回对"__imp_SetDIBitsToDevice"的未定义引用
- 对Py_Initialize()的未定义引用
- 使用mysql c++连接器的未定义引用
- 对 Scalar ::Scalar() 的未定义引用
- 对复制 CTOR 和 CTOR 的未定义引用
- 对显式实例化的模板函数的未定义引用
- TensorRT (C++ API) 对"createNvOnnxParser_INTERNAL"的未定义引用
- 2个模板化类的非模板友元函数未定义引用错误
- 编译 libfluid 样本控制器时对"event_base_del_virtual"的未定义引用
- 获取对function_name的未定义引用
- 对 'std::thread::_M_start_thread CMake 的未定义引用进行基准测试
- 对结构方法的未定义引用
- 使用内联函数 c++ 的未定义引用
- 对 CMake 中'cudaRegisterLinkedBinary'链接错误的未定义引用?
- 对 DLOPEN 的未定义引用
- QT C++中对全局变量的未定义引用
- 快速数学导致对"__pow_finite"的未定义引用
- 对 boost::system::d etail::system_category_instance 的未定义引用,从
- OpenCV 3.4.3 中对 'cv::String::d eallocate()' 错误的未定义引用