如何解决来自 stb_image 的这些编译器警告?

问题描述

我正在使用 stb_image 库来帮助加载图像/纹理,遵循“The Cherno”的 OpenGL 教程播放列表。虽然我能够成功加载和渲染图像,但每当我构建项目时都会收到这些编译器警告。如何在不禁用警告的情况下解决这些警告?

警告:

"compilerOptions": {
        "baseUrl": ".","esModuleInterop": true,"experimentalDecorators": true,"module": "commonjs","moduleResolution": "node","outDir": "dist","strict": true,"sourceMap": true,"target": "es6",...

stb_image.h 文件代码是从这个网站获得的(代码没有被改动):https://github.com/nothings/stb/blob/master/stb_image.h

stb_image.h 实现:

In file included from src/Texture.cpp:3:
src/vendor/stb_image/stb_image.h: In function 'int stbi__zhuffman_decode_slowpath(stbi__zbuf*,stbi__zhuffman*)':
src/vendor/stb_image/stb_image.h:4123:10: warning: comparison of integer expressions of different signedness: 'int' and 'long long unsigned int' [-Wsign-compare]
    if (b >= sizeof (z->size)) return -1; // some data was corrupt somewhere!
        ~~^~~~~~~~~~~~~~~~~~~
src/vendor/stb_image/stb_image.h: In function 'void* stbi__load_gif_main(stbi__context*,int**,int*,int)':
src/vendor/stb_image/stb_image.h:6778:11: warning: variable 'out_size' set but not used [-Wunused-but-set-variable]
       int out_size = 0;
           ^~~~~~~~
src/vendor/stb_image/stb_image.h:6779:11: warning: variable 'delays_size' set but not used [-Wunused-but-set-variable]
       int delays_size = 0;
           ^~~~~~~~~~~

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)