我找不到编译器中指出的函数

I can't find the function that is pointed out in the compiler

我在 openvg 库上工作。实际上,我为 运行 代码块工作(在树莓派上):https://github.com/raspberrypi/firmware/blob/master/opt/vc/src/hello_pi/hello_font/main.c

我实现了渲染颜色,但看到了锯齿现象。但我想用同样的方法在屏幕上写文字。我分析了这个库:https://github.com/raspberrypi/firmware/blob/master/opt/vc/src/hello_pi/libs/vgfont/vgfont.h 并尝试使用 graphics_resource_render_text_ext() 函数,但我在新终端上收到了这条消息 window:

assertion failure:font.c:176:gx_priv_render_text():inited aborted

我的编译构建消息是这样的:

Font.c 的路径:https://github.com/adafruit/rpi-firmware/blob/master/vc/sdk/opt/vc/src/hello_pi/libs/vgfont/font.c

我在 font.c 上转到 176. 行并尝试调用 gx_font_init()(终端 window 备注此行。)但我无法在任何地方找到此功能(我尝试在覆盆子的)。如果我取消 graphics_resource_render_text_ext() 命令,我的代码就很好用。为什么我不能使用这个功能?我的代码是这样的:

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
#include "bcm_host.h"
#include "vgfont.h"
#include "openvg.h"
#include "egl.h"
#include "vgu.h"
#include "fontinfo.h"
#include "shapes.h"
#include "eglplatform.h"
#include "graphics_x_private.h"

int main()
{       
    GRAPHICS_RESOURCE_HANDLE img;
    uint32_t width, height;
    int LAYER = 1;
    bcm_host_init();

    int s;

    s = gx_graphics_init(".");
    assert(s == 0);
    s = graphics_get_display_size(0, &width, &height);
    assert(s == 0);
    s = gx_create_window(0, width, height, GRAPHICS_RESOURCE_RGBA32, &img);
    assert(s == 0);

    graphics_resource_fill(img, 0, 0, width, height, GRAPHICS_RGBA32(0, 0, 0, 0x00));
    graphics_display_resource(img, 0, LAYER, 0, 0, GRAPHICS_RESOURCE_WIDTH, GRAPHICS_RESOURCE_HEIGHT, VC_DISPMAN_ROT0, 1 );

    while(1)
    {
        graphics_resource_fill(img, 0, 0,width, height, GRAPHICS_RGBA32(0,0,0,0x55));
        graphics_resource_fill(img, 600, 500, 100, 50, GRAPHICS_RGBA32(0,0,0xff,0xaa));
        graphics_resource_fill(img, 600, 400, 200, 50, GRAPHICS_RGBA32(0,0xff,0,0xaa));

        graphics_resource_render_text_ext( img, 100, 100, 200, 200, GRAPHICS_RGBA32(0xff,0,0,0xdd), GRAPHICS_RGBA32(0, 0xff,0, 0xdd), "hello", strlen("hello"), 20);  // This line has problem.

        graphics_update_displayed_resource(img, 0,0,0,0);
    }

    graphics_display_resource(img, 0, LAYER, 0, 0, GRAPHICS_RESOURCE_WIDTH, GRAPHICS_RESOURCE_HEIGHT, VC_DISPMAN_ROT0, 0); 
    graphics_delete_resource(img);

    printf("Hello world!\n");
    return 0;
}

注意: 在我取消 graphics_resource_render_text_ext() 时没有更改编译器构建消息,但代码运行良好。

gx_priv_render_textsource code 看来断言失败,因为未设置 inited 静态变量。

这个变量是通过gx_graphics_init设置的(是here inside graphics.c),初始化成功会调用gx_priv_font_init

因此,gx_priv_initialise 中某处初始化失败。在那里设置断点并逐步执行函数,并检查日志(它应该包含在该函数中找到的错误消息之一)。