【问题标题】:Build Errors with Raylib使用 Raylib 构建错误
【发布时间】:2022-11-26 14:05:28
【问题描述】:

所以我试图从头开始构建 raylib,以便我可以在 vs 代码中使用它,并按照有关如何根据 wiki 构建它的说明进行操作,但是给了我多个错误,我安装了 Mingw,我从两个网站下载了 raylib 项目安装程序和来自 github 但它给了我一个错误,如果你知道答案然后让我知道 :)

命令日志:

Microsoft Windows [Version 10.0.22000.978]
(c) Microsoft Corporation. All rights reserved.

C:\Users\Acer\Downloads\raylib-master\src>mingw32-make PLATFORM=PLATFORM_DESKTOP
gcc -c rcore.c -Wall -D_GNU_SOURCE -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -Wno-missing-braces -Werror=pointer-arith -fno-strict-aliasing  -std=c99 -O1 -Werror=implicit-function-declaration -I. -Iexternal/glfw/include -Iexternal/glfw/deps/mingw
gcc -c rshapes.c -Wall -D_GNU_SOURCE -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -Wno-missing-braces -Werror=pointer-arith -fno-strict-aliasing  -std=c99 -O1 -Werror=implicit-function-declaration -I. -Iexternal/glfw/include -Iexternal/glfw/deps/mingw
gcc -c rtextures.c -Wall -D_GNU_SOURCE -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -Wno-missing-braces -Werror=pointer-arith -fno-strict-aliasing  -std=c99 -O1 -Werror=implicit-function-declaration -I. -Iexternal/glfw/include -Iexternal/glfw/deps/mingw
In file included from rtextures.c:156:0:
external/rl_gputex.h:774:12: warning: 'get_pixel_data_size' defined but not used [-Wunused-function]
 static int get_pixel_data_size(int width, int height, int format)
            ^~~~~~~~~~~~~~~~~~~
gcc -c rtext.c -Wall -D_GNU_SOURCE -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -Wno-missing-braces -Werror=pointer-arith -fno-strict-aliasing  -std=c99 -O1 -Werror=implicit-function-declaration -I. -Iexternal/glfw/include -Iexternal/glfw/deps/mingw
In file included from rtext.c:76:0:
external/stb_truetype.h:4962:15: warning: 'stbtt_CompareUTF8toUTF16_bigendian' defined but not used [-Wunused-function]
 STBTT_DEF int stbtt_CompareUTF8toUTF16_bigendian(const char *s1, int len1, const char *s2, int len2)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
external/stb_truetype.h:4957:15: warning: 'stbtt_FindMatchingFont' defined but not used [-Wunused-function]
 STBTT_DEF int stbtt_FindMatchingFont(const unsigned char *fontdata, const char *name, int flags)
               ^~~~~~~~~~~~~~~~~~~~~~
external/stb_truetype.h:4947:15: warning: 'stbtt_GetNumberOfFonts' defined but not used [-Wunused-function]
 STBTT_DEF int stbtt_GetNumberOfFonts(const unsigned char *data)
               ^~~~~~~~~~~~~~~~~~~~~~
external/stb_truetype.h:4935:15: warning: 'stbtt_BakeFontBitmap' defined but not used [-Wunused-function]
 STBTT_DEF int stbtt_BakeFontBitmap(const unsigned char *data, int offset,
               ^~~~~~~~~~~~~~~~~~~~
external/stb_truetype.h:4822:23: warning: 'stbtt_GetFontNameString' defined but not used [-Wunused-function]
 STBTT_DEF const char *stbtt_GetFontNameString(const stbtt_fontinfo *font, int *length, int platformID, int encodingID, int languageID, int nameID)
                       ^~~~~~~~~~~~~~~~~~~~~~~
external/stb_truetype.h:4765:16: warning: 'stbtt_FreeSDF' defined but not used [-Wunused-function]
 STBTT_DEF void stbtt_FreeSDF(unsigned char *bitmap, void *userdata)
                ^~~~~~~~~~~~~
external/stb_truetype.h:4363:16: warning: 'stbtt_GetPackedQuad' defined but not used [-Wunused-function]
 STBTT_DEF void stbtt_GetPackedQuad(const stbtt_packedchar *chardata, int pw, int ph, int char_index, float *xpos, float *ypos, stbtt_aligned_quad *q, int align_to_integer)
                ^~~~~~~~~~~~~~~~~~~
external/stb_truetype.h:4350:16: warning: 'stbtt_GetScaledFontVMetrics' defined but not used [-Wunused-function]
 STBTT_DEF void stbtt_GetScaledFontVMetrics(const unsigned char *fontdata, int index, float size, float *ascent, float *descent, float *lineGap)
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~
external/stb_truetype.h:4338:15: warning: 'stbtt_PackFontRange' defined but not used [-Wunused-function]
 STBTT_DEF int stbtt_PackFontRange(stbtt_pack_context *spc, const unsigned char *fontdata, int font_index, float font_size,
               ^~~~~~~~~~~~~~~~~~~
external/stb_truetype.h:4005:16: warning: 'stbtt_PackSetSkipMissingCodepoints' defined but not used [-Wunused-function]
 STBTT_DEF void stbtt_PackSetSkipMissingCodepoints(stbtt_pack_context *spc, int skip)
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
external/stb_truetype.h:3995:16: warning: 'stbtt_PackSetOversampling' defined but not used [-Wunused-function]
 STBTT_DEF void stbtt_PackSetOversampling(stbtt_pack_context *spc, unsigned int h_oversample, unsigned int v_oversample)
                ^~~~~~~~~~~~~~~~~~~~~~~~~
external/stb_truetype.h:3989:16: warning: 'stbtt_PackEnd' defined but not used [-Wunused-function]
 STBTT_DEF void stbtt_PackEnd  (stbtt_pack_context *spc)
                ^~~~~~~~~~~~~
external/stb_truetype.h:3957:15: warning: 'stbtt_PackBegin' defined but not used [-Wunused-function]
 STBTT_DEF int stbtt_PackBegin(stbtt_pack_context *spc, unsigned char *pixels, int pw, int ph, int stride_in_bytes, int padding, void *alloc_context)
               ^~~~~~~~~~~~~~~
external/stb_truetype.h:3859:16: warning: 'stbtt_GetBakedQuad' defined but not used [-Wunused-function]
 STBTT_DEF void stbtt_GetBakedQuad(const stbtt_bakedchar *chardata, int pw, int ph, int char_index, float *xpos, float *ypos, stbtt_aligned_quad *q, int opengl_fillrule)
                ^~~~~~~~~~~~~~~~~~
external/stb_truetype.h:3802:16: warning: 'stbtt_MakeCodepointBitmap' defined but not used [-Wunused-function]
 STBTT_DEF void stbtt_MakeCodepointBitmap(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, int codepoint)
                ^~~~~~~~~~~~~~~~~~~~~~~~~
external/stb_truetype.h:3787:16: warning: 'stbtt_MakeCodepointBitmapSubpixelPrefilter' defined but not used [-Wunused-function]
 STBTT_DEF void stbtt_MakeCodepointBitmapSubpixelPrefilter(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int oversample_x, int oversample_y, float *sub_x, float *sub_y, int codepoint)
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
external/stb_truetype.h:3753:26: warning: 'stbtt_GetGlyphBitmap' defined but not used [-Wunused-function]
 STBTT_DEF unsigned char *stbtt_GetGlyphBitmap(const stbtt_fontinfo *info, float scale_x, float scale_y, int glyph, int *width, int *height, int *xoff, int *yoff)
                          ^~~~~~~~~~~~~~~~~~~~
external/stb_truetype.h:3708:16: warning: 'stbtt_FreeBitmap' defined but not used [-Wunused-function]
 STBTT_DEF void stbtt_FreeBitmap(unsigned char *bitmap, void *userdata)
                ^~~~~~~~~~~~~~~~
external/stb_truetype.h:2749:16: warning: 'stbtt_GetCodepointBitmapBox' defined but not used [-Wunused-function]
 STBTT_DEF void stbtt_GetCodepointBitmapBox(const stbtt_fontinfo *font, int codepoint, float scale_x, float scale_y, int *ix0, int *iy0, int *ix1, int *iy1)
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~
external/stb_truetype.h:2711:15: warning: 'stbtt_GetCodepointSVG' defined but not used [-Wunused-function]
 STBTT_DEF int stbtt_GetCodepointSVG(const stbtt_fontinfo *info, int unicode_codepoint, const char **svg)
               ^~~~~~~~~~~~~~~~~~~~~
external/stb_truetype.h:2672:16: warning: 'stbtt_FreeShape' defined but not used [-Wunused-function]
 STBTT_DEF void stbtt_FreeShape(const stbtt_fontinfo *info, stbtt_vertex *v)
                ^~~~~~~~~~~~~~~
external/stb_truetype.h:2652:16: warning: 'stbtt_GetFontBoundingBox' defined but not used [-Wunused-function]
 STBTT_DEF void stbtt_GetFontBoundingBox(const stbtt_fontinfo *info, int *x0, int *y0, int *x1, int *y1)
                ^~~~~~~~~~~~~~~~~~~~~~~~
external/stb_truetype.h:2641:16: warning: 'stbtt_GetFontVMetricsOS2' defined but not used [-Wunused-function]
 STBTT_DEF int  stbtt_GetFontVMetricsOS2(const stbtt_fontinfo *info, int *typoAscent, int *typoDescent, int *typoLineGap)
                ^~~~~~~~~~~~~~~~~~~~~~~~
external/stb_truetype.h:2622:16: warning: 'stbtt_GetCodepointKernAdvance' defined but not used [-Wunused-function]
 STBTT_DEF int  stbtt_GetCodepointKernAdvance(const stbtt_fontinfo *info, int ch1, int ch2)
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
external/stb_truetype.h:2332:15: warning: 'stbtt_GetKerningTable' defined but not used [-Wunused-function]
 STBTT_DEF int stbtt_GetKerningTable(const stbtt_fontinfo *info, stbtt_kerningentry* table, int table_length)
               ^~~~~~~~~~~~~~~~~~~~~
external/stb_truetype.h:2317:16: warning: 'stbtt_GetKerningTableLength' defined but not used [-Wunused-function]
 STBTT_DEF int  stbtt_GetKerningTableLength(const stbtt_fontinfo *info)
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~
external/stb_truetype.h:1646:15: warning: 'stbtt_IsGlyphEmpty' defined but not used [-Wunused-function]
 STBTT_DEF int stbtt_IsGlyphEmpty(const stbtt_fontinfo *info, int glyph_index)
               ^~~~~~~~~~~~~~~~~~
external/stb_truetype.h:1641:15: warning: 'stbtt_GetCodepointBox' defined but not used [-Wunused-function]
 STBTT_DEF int stbtt_GetCodepointBox(const stbtt_fontinfo *info, int codepoint, int *x0, int *y0, int *x1, int *y1)
               ^~~~~~~~~~~~~~~~~~~~~
external/stb_truetype.h:1589:15: warning: 'stbtt_GetCodepointShape' defined but not used [-Wunused-function]
 STBTT_DEF int stbtt_GetCodepointShape(const stbtt_fontinfo *info, int unicode_codepoint, stbtt_vertex **vertices)
               ^~~~~~~~~~~~~~~~~~~~~~~
gcc -c utils.c -Wall -D_GNU_SOURCE -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -Wno-missing-braces -Werror=pointer-arith -fno-strict-aliasing  -std=c99 -O1 -Werror=implicit-function-declaration -I. -Iexternal/glfw/include -Iexternal/glfw/deps/mingw
gcc  -c rglfw.c -Wall -D_GNU_SOURCE -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -Wno-missing-braces -Werror=pointer-arith -fno-strict-aliasing  -std=c99 -O1 -Werror=implicit-function-declaration -I. -Iexternal/glfw/include -Iexternal/glfw/deps/mingw
In file included from rglfw.c:73:0:
external/glfw/src/win32_window.c: In function 'updateCursorImage':
external/glfw/src/win32_window.c:247:41: warning: passing argument 2 of 'LoadCursorW' from incompatible pointer type [-Wincompatible-pointer-types]
             SetCursor(LoadCursorW(NULL, IDC_ARROW));
                                         ^~~~~~~~~
In file included from c:\mingw\include\windows.h:48:0,
                 from external/glfw/src/win32_platform.h:68,
                 from external/glfw/src/platform.h:31,
                 from external/glfw/src/internal.h:331,
                 from external/glfw/src/init.c:30,
                 from rglfw.c:61:
c:\mingw\include\winuser.h:3999:27: note: expected 'LPCWSTR {aka const short unsigned int *}' but argument is of type 'CHAR * {aka char *}'
 WINUSERAPI HCURSOR WINAPI LoadCursorW (HINSTANCE, LPCWSTR);
                           ^~~~~~~~~~~
In file included from rglfw.c:73:0:
external/glfw/src/win32_window.c: In function 'createNativeWindow':
external/glfw/src/win32_window.c:1277:46: warning: passing argument 2 of 'LoadCursorW' from incompatible pointer type [-Wincompatible-pointer-types]
         wc.hCursor       = LoadCursorW(NULL, IDC_ARROW);
                                              ^~~~~~~~~
In file included from c:\mingw\include\windows.h:48:0,
                 from external/glfw/src/win32_platform.h:68,
                 from external/glfw/src/platform.h:31,
                 from external/glfw/src/internal.h:331,
                 from external/glfw/src/init.c:30,
                 from rglfw.c:61:
c:\mingw\include\winuser.h:3999:27: note: expected 'LPCWSTR {aka const short unsigned int *}' but argument is of type 'CHAR * {aka char *}'
 WINUSERAPI HCURSOR WINAPI LoadCursorW (HINSTANCE, LPCWSTR);
                           ^~~~~~~~~~~
In file included from rglfw.c:73:0:
external/glfw/src/win32_window.c:1291:35: warning: passing argument 2 of 'LoadImageW' from incompatible pointer type [-Wincompatible-pointer-types]
                                   IDI_APPLICATION, IMAGE_ICON,
                                   ^~~~~~~~~~~~~~~
In file included from c:\mingw\include\windows.h:48:0,
                 from external/glfw/src/win32_platform.h:68,
                 from external/glfw/src/platform.h:31,
                 from external/glfw/src/internal.h:331,
                 from external/glfw/src/init.c:30,
                 from rglfw.c:61:
c:\mingw\include\winuser.h:4011:26: note: expected 'LPCWSTR {aka const short unsigned int *}' but argument is of type 'CHAR * {aka char *}'
 WINUSERAPI HANDLE WINAPI LoadImageW (HINSTANCE, LPCWSTR, UINT, int, int, UINT);
                          ^~~~~~~~~~
gcc -c rmodels.c -Wall -D_GNU_SOURCE -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -Wno-missing-braces -Werror=pointer-arith -fno-strict-aliasing  -std=c99 -O1 -Werror=implicit-function-declaration -I. -Iexternal/glfw/include -Iexternal/glfw/deps/mingw
In file included from rmodels.c:77:0:
external/cgltf.h: In function 'cgltf_default_file_read':
external/cgltf.h:999:20: error: implicit declaration of function '_ftelli64' [-Werror=implicit-function-declaration]
   __int64 length = _ftelli64(file);
                    ^~~~~~~~~
In file included from rmodels.c:96:0:
external/m3d.h: In function 'm3d_load':
external/m3d.h:3765:53: warning: 'mi' may be used uninitialized in this function [-Wmaybe-uninitialized]
                         model->voxel[i].data[j++] = (M3D_VOXEL)mi;
                                                     ^~~~~~~~~~~~~
cc1.exe: some warnings being treated as errors
Makefile:674: recipe for target 'rmodels.o' failed
mingw32-make: *** [rmodels.o] Error 1

编辑:所以我更新到更高版本的 mingw 并尝试再次构建 raylib 但它没有用但是错误更少所以很好,

命令输出:

Microsoft Windows [Version 10.0.22000.978]
(c) Microsoft Corporation. All rights reserved.

C:\Users\Acer\Downloads\raylib-master\src>mingw32-make PLATFORM=PLATFORM_DESKTOP
gcc -c rmodels.c -Wall -D_GNU_SOURCE -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -Wno-missing-braces -Werror=pointer-arith -fno-strict-aliasing  -std=c99 -O1 -Werror=implicit-function-declaration -I. -Iexternal/glfw/include -Iexternal/glfw/deps/mingw
In file included from rmodels.c:77:0:
external/cgltf.h: In function 'cgltf_default_file_read':
external/cgltf.h:999:20: error: implicit declaration of function '_ftelli64' [-Werror=implicit-function-declaration]
   __int64 length = _ftelli64(file);
                    ^~~~~~~~~
In file included from rmodels.c:96:0:
external/m3d.h: In function 'm3d_load':
external/m3d.h:3765:53: warning: 'mi' may be used uninitialized in this function [-Wmaybe-uninitialized]
                         model->voxel[i].data[j++] = (M3D_VOXEL)mi;
                                                     ^~~~~~~~~~~~~
cc1.exe: some warnings being treated as errors
Makefile:674: recipe for target 'rmodels.o' failed
mingw32-make: *** [rmodels.o] Error 1

【问题讨论】:

标签: c++ mingw raylib


【解决方案1】:

旧版本的 Mingw are missing _ftelli64,尝试升级到新版本或使用链接建议的带有额外 -D_ftelli64=ftello64 编译标志的解决方法。

其余的警告主要是因为有人将 stb_truetype 添加为普通的“项目”标头而不是系统标头,因此编译器警告某些已定义的函数未被使用并且可以被删除。

GLFW 警告有点可疑,但可能并不严重。

【讨论】:

  • 哪里可以获得最新版本的mingw?
  • @Jacket here我觉得
  • 这会取代现有的 mingw 安装吗?
  • @夹克我不知道
  • 它没有用它仍然说,cc1.exe:一些警告被视为错误Makefile:674:目标'rmodels.o'的配方失败mingw32-make:*** [rmodels.o]错误1
【解决方案2】:

谢谢@HolyBlackCat 成功了

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-06-21
    • 1970-01-01
    • 2012-09-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多