繁体   English   中英

未找到 SDL_Vertex 和 SDL_RenderGeometry

[英]SDL_Vertex and SDL_RenderGeometry not found

我在 Windows 下用 SDL2 做了一个项目。

当我尝试在 Linux 上编译它时,会出现以下错误:

reilbas@reilbas:~/C/a/Labyrinthe-3D-main$ g++ -o test -I include src/*.cpp $(sdl2-config --cflags --libs)
src/Affichage.cpp: In member function ‘void Affichage::drawRect(float, float, float, float, SDL_Color&)’:
src/Affichage.cpp:110:17: error: ‘SDL_Vertex’ was not declared in this scope; did you mean ‘SDL_mutex’?
  110 |     std::vector<SDL_Vertex> triUi1 = {
      |                 ^~~~~~~~~~
      |                 SDL_mutex
src/Affichage.cpp:110:27: error: template argument 1 is invalid
  110 |     std::vector<SDL_Vertex> triUi1 = {
      |                           ^
src/Affichage.cpp:110:27: error: template argument 2 is invalid
src/Affichage.cpp:110:29: error: scalar object ‘triUi1’ requires one element in initializer
  110 |     std::vector<SDL_Vertex> triUi1 = {
      |                             ^~~~~~
src/Affichage.cpp:115:27: error: template argument 2 is invalid
  115 |     std::vector<SDL_Vertex> triUi2 = {
      |                           ^
src/Affichage.cpp:115:29: error: scalar object ‘triUi2’ requires one element in initializer
  115 |     std::vector<SDL_Vertex> triUi2 = {
      |                             ^~~~~~
src/Affichage.cpp:120:5: error: ‘SDL_RenderGeometry’ was not declared in this scope; did you mean ‘SDL_RenderCopy’?
  120 |     SDL_RenderGeometry(renderer, nullptr, triUi1.data(), triUi1.size(), nullptr, 0);
      |     ^~~~~~~~~~~~~~~~~~
      |     SDL_RenderCopy
src/Affichage.cpp: In member function ‘void Affichage::displayTri(std::vector<triangle>)’:
src/Affichage.cpp:146:21: error: ‘SDL_Vertex’ was not declared in this scope; did you mean ‘SDL_mutex’?
  146 |         std::vector<SDL_Vertex> verts = {
      |                     ^~~~~~~~~~
      |                     SDL_mutex
src/Affichage.cpp:146:31: error: template argument 1 is invalid
  146 |         std::vector<SDL_Vertex> verts = {
      |                               ^
src/Affichage.cpp:146:31: error: template argument 2 is invalid
src/Affichage.cpp:146:33: error: scalar object ‘verts’ requires one element in initializer
  146 |         std::vector<SDL_Vertex> verts = {
      |                                 ^~~~~
src/Affichage.cpp:151:9: error: ‘SDL_RenderGeometry’ was not declared in this scope; did you mean ‘SDL_RenderCopy’?
  151 |         SDL_RenderGeometry( renderer, nullptr, verts.data(), verts.size(), nullptr, 0);
      |         ^~~~~~~~~~~~~~~~~~
      |         SDL_RenderCopy
src/AllMath.cpp: In static member function ‘static int AllMath::triangleClipAgainstPlane(vec3d, vec3d, triangle&, triangle&, triangle&)’:
src/AllMath.cpp:254:1: warning: control reaches end of non-void function [-Wreturn-type]
  254 | }
      | ^

我用 apt 安装了 SDL2:

$ sudo apt-get install libsdl2

SDL_RenderGeometry()和朋友 在 SDL 2.0.18 中被引入

  • 添加了 SDL_RenderGeometry() 和 SDL_RenderGeometryRaw() 以允许使用 SDL 2D 渲染器渲染任意形状 API

...因此请确保您使用的是该版本或更高版本。

SDL 2.0.18 于 2021 年底发布,因此像 Ubuntu 20.04 这样发布旧版本 SDL 的发行版将不具备这些新功能。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM