我正在尝试编译以下具有标题的代码:
#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 上运行这个。
我正在编写一个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)