错误:无法使用 SDL 1.3 打开流
我尝试在 Ubuntu Linux 上使用 SDL 1.3 库运行以下代码。 我收到以下错误:
错误:无法打开流 错误:无法
在
SDL_Init 和 SDL_CreateWindow处打开流
#include <SDL/SDL.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char** argv) {
if((SDL_Init(SDL_INIT_VIDEO) != 0))
{
printf("[!] can't initialize SDL %s\n", SDL_GetError());
exit(-1);
}
// if((SDL_VideoInit(NULL) != 0))
// {
// printf("[!] can't initialize video %s\n", SDL_GetError());
// exit(-1);
// }
SDL_Window* win;
if(!(win = SDL_CreateWindow("SDL 1.3", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 640, 480, SDL_WINDOW_SHOWN)))
{
printf("[!] can't create Window %s", SDL_GetError());
exit(-1);
}
SDL_DestroyWindow(win);
SDL_Quit();
return 0;
}
I tried to run the following code with the SDL 1.3 library on Ubuntu Linux.
I got the following Error:
Error: Couldn't open stream
Error: Couldn't open stream
At
SDL_Init and SDL_CreateWindow
#include <SDL/SDL.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char** argv) {
if((SDL_Init(SDL_INIT_VIDEO) != 0))
{
printf("[!] can't initialize SDL %s\n", SDL_GetError());
exit(-1);
}
// if((SDL_VideoInit(NULL) != 0))
// {
// printf("[!] can't initialize video %s\n", SDL_GetError());
// exit(-1);
// }
SDL_Window* win;
if(!(win = SDL_CreateWindow("SDL 1.3", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 640, 480, SDL_WINDOW_SHOWN)))
{
printf("[!] can't create Window %s", SDL_GetError());
exit(-1);
}
SDL_DestroyWindow(win);
SDL_Quit();
return 0;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在我的 Ubuntu 机器上使用以下命令编译代码没有任何问题:
ldd 的输出显示了正在链接的应用程序:
执行应用程序时,
初始化触摸...
打印到控制台。顺便说一句,我从源代码下载并编译了 SDL。I had no problems compiling your code on my Ubuntu box with:
And the output of ldd shows the application being linked with:
When the application is executed,
Initializing touch...
is printed to the console. By the way, I downloaded and compiled SDL from sources.