나는 알레그로 (5)을 설정하고 성공 다음 코드를 컴파일 할 수 있습니다 :allegro5 - Linux에서 실행하는 방법?
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <allegro5/allegro.h>
void error(char *msg)
{
fprintf(stderr,"%s : %s\n", msg, strerror(errno));
exit(1);
}
int main(int argc, char **argv)
{
ALLEGRO_DISPLAY *display = NULL;
if(!al_init())
error("Could not initailize allegro");
display = al_create_display(640, 480);
if(!display)
error("fail to display");
al_clear_to_color(al_map_rgb(0,0,0));
al_flip_display();
al_rest(10.0);
al_destroy_display(display);
return 0;
}
을하지만 그것을 실행 한 후, 그것은 오류 메시지와 함께 실패
알레그로 initailize 없습니다 수 없습니다 : 그런 파일을 또는 디렉토리.
무엇이 잘못 되었나요?
gcc try.c -lallegro
그러나 그것을 실행할 수 없습니다 :
./a.out
내가 알레그로 알고 있지만 strace를를 설치하고 그것을 찾을 수없는 정확하게 볼 수있는'strace를/a.out'를 실행하지 마십시오.. –
다음과 같습니다 : access ("/ etc/ld.so.nohwcap", F_OK) = -1 ENOENT (해당 파일이나 디렉토리가 없습니다) open ("/ home/tom/Exercise/c/game/allegro5.cfg", O_RDONLY ("/ home/dreamloser/allegro5rc", O_RDONLY) = -1 ENOENT (해당 파일이나 디렉토리가 없음) open ("/ etc/allegro5rc", O_RDONLY) = -1 ENOENT (해당 파일이나 디렉토리가 없음) open 1 ENOENT (해당 파일이나 디렉토리가 없음) –
'-lallegro' 대신'pkg-config'를 사용해야합니다. 어쨌든, Allegro의 디버그 버전을 컴파일하고 allegro.log를 확인하십시오. – Matthew