Skip to content

接入nvboard的参数 #52

@Discovery493

Description

@Discovery493

在接入nvboard时,链接参数除了-lSDL2 -lSDL2_image,可能还需要加上-lSDL2_ttf
我在ubuntu 22.04.1上链接项目中生成的库文件nvboard.a时,只添加前两个参数,部分报错如下(libsdl2-dev版本为 2.0.20 ):

/usr/bin/ld: /path/to/nvboard/build/nvboard.a(font.o): in function `init_font(SDL_Renderer*)': // 此行路径打码处理
font.cpp:(.text+0xb9): undefined reference to `TTF_Init'
/usr/bin/ld: font.cpp:(.text+0x223): undefined reference to `TTF_OpenFont'
/usr/bin/ld: font.cpp:(.text+0x274): undefined reference to `TTF_SetFontHinting'
/usr/bin/ld: font.cpp:(.text+0x285): undefined reference to `TTF_SetFontStyle'
/usr/bin/ld: font.cpp:(.text+0x2a5): undefined reference to `TTF_RenderText_Shaded_Wrapped'
/usr/bin/ld: font.cpp:(.text+0x2d1): undefined reference to `TTF_SetFontSize'
/usr/bin/ld: font.cpp:(.text+0x2f9): undefined reference to `TTF_RenderGlyph_Shaded'
...

在加入-lSDL2_ttf选项后即报错消失,链接成功。
可以据此修改一下README.md的相关内容?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions