小编mas*_*as4的帖子

未找到 SDL2_image

我正在尝试编译以下具有标题的代码:

#include <SDL2/SDL.h>
#include <SDL2_image/SDL_image.h>
Run Code Online (Sandbox Code Playgroud)

但是在运行以下 makefile 后:

g++ -std=c++11 src/main.cpp -lSDL2 -lSDL2_image
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

fatal error: SDL2_image/SDL_image.h: No such file or directory
#include <SDL2_image/SDL_image.h>
Run Code Online (Sandbox Code Playgroud)

有什么建议?不完全确定我安装的 SDL_image。我在 Ubuntu 上运行这个。

c++ ubuntu sdl sdl-image sdl-2

7
推荐指数
2
解决办法
1万
查看次数

为什么这里有无效写(Valgrind)

我正在编写一个shell.当我像这样执行它cat /dev/urandom | valgrind ./myshell来运行一些测试,看看我是否有任何段错误或其他错误时,valgrind有时告诉我,我在这行有一个Invalid Write函数my_wordcpytab[++j] = str[*i];

它不会每次都发生,但它确实发生了,我只是不明白为什么.这是我的代码:

static int      count_words(char *str, char *sep)
{
  int           quote;
  int           words;
  int           i;

  i = -1;
  if (count_quotes(str) == -1)
    return (0);
  words = 0;
  quote = 0;
  while (str[++i] != '\0')
    {
      if (str[i] == '"')
        {
          if (quote == 0)
            quote = 1;
          else
            quote = 0;
        }
      if (quote == 0
          && (is_cinside(sep, str[i]) == 0 && str[i] != '\t' …
Run Code Online (Sandbox Code Playgroud)

c valgrind

4
推荐指数
1
解决办法
138
查看次数

标签 统计

c ×1

c++ ×1

sdl ×1

sdl-2 ×1

sdl-image ×1

ubuntu ×1

valgrind ×1