找不到文件“ SDL.h”,但是程序会编译

时间:2019-04-30 12:27:26

标签: c++ sdl

我设法编译了使用SDL的示例程序

#include "SDL.h" 

int main(int argc, char *argv[])
{
  SDL_Init(SDL_INIT_VIDEO);

  SDL_Window *window = SDL_CreateWindow(
    "SDL2Test",
    SDL_WINDOWPOS_UNDEFINED,
    SDL_WINDOWPOS_UNDEFINED,
    640,
    480,
    0
  );

  SDL_Renderer *renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_SOFTWARE);
  SDL_SetRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE);
  SDL_RenderClear(renderer);
  SDL_RenderPresent(renderer);

  SDL_Delay(3000);

  SDL_DestroyWindow(window);
  SDL_Quit();

  return 0;
}

使用以下CMake文件

cmake_minimum_required(VERSION 2.8)
project( project )

find_package(SDL2 REQUIRED)
include_directories(${SDL2_INCLUDE_DIRS})

add_executable( project sdl.cpp )
target_link_libraries( project ${SDL2_LIBRARIES})

但是我无法确定“ SDL.h”在哪里。 locate SDL.h也不起作用。是“隐藏在幕后”的某个地方,还是我在做错字错误?

SDL2是通过sudo apt-get install libsdl2-dev

安装的

0 个答案:

没有答案