gpt4 book ai didi

c++ - Linux 中的 SDL 库

转载 作者:太空宇宙 更新时间:2023-11-04 09:02:43 24 4
gpt4 key购买 nike

我正在尝试编译这段代码:

#include "SDL/SDL.h"

int main(void) {

SDL_Surface *Hello = NULL;
SDL_Surface *Screen = NULL;

SDL_Init( SDL_INIT_EVERYTHING );

return 0;
}

但是碰巧编译器说:

undefined reference to SDL_Init

我不知道为什么会这样。我正在使用 Debian Mint 和 Code::Blocks。你能帮帮我吗?

最佳答案

看起来您的链接行上没有 -lSDL

sdl-config 返回您安装的 SDL 的编译和链接标志。

假设程序是sdl.cpp

g++ -o sdl `sdl-config --cflags` sdl.cpp `sdl-config --libs`

应该给你正确的标志。

关于c++ - Linux 中的 SDL 库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17846268/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com