2017-03-17 2 views
0

저는 Allegro 5.0을 사용하여 만든 게임 (Windows에서 Raspian을 실행하는 Raspberry Pi)으로 이식하려고합니다. Allegro를 설치하고 모든 소스 파일을 옮겼지만 다음을 사용하여 컴파일하려고 할 때 : * g ++ -std = C++ 0x .cpp -o SpaceFighter $ (pkg-config --libs allegro-5) I 얻을 다음Allegro 5 게임이 GCC로 컴파일되지 않습니다

/tmp/ccBliSky.o : 함수 main': main.cpp:(.text+0x130): undefined reference to al_show_native_message_box에서 '. :( MAIN.CPP 텍스트 + 0x160) al_init_font_addon' main.cpp:(.text+0x164): undefined reference to al_init_ttf_addon에 정의되지 않은 참조' MAIN.CPP :(텍스트 + 0x168). : 정의되지 않은 참조 al_init_image_addon' main.cpp:(.text+0x1a4): undefined reference to al_load_ttf_font ' main.cpp :(. 텍스트 + 0x574) : 정의되지 않은 참조 al_draw_textf' /tmp/ccBMyqom.o: In function MenuItem :: MenuItem()': MenuItem.cpp :(. 텍스트 + 0xa0) : 정의되지 않은 참조 al_load_ttf_font' /tmp/ccBMyqom.o: In function 남자 uItem :: ~ MenuItem() ': MenuItem.cpp :(. 텍스트 + 0x1ac) : 정의되지 않은 참조 al_destroy_font' /tmp/ccBMyqom.o: In function MenuItem :: Draw (GameTime const *)': MenuItem.cpp :(. 텍스트 + 0x2fc) : 정의되지 않은 참조 al_draw_text' /tmp/ccKXP3ds.o: In function PlayerShip :: SetAudioSample (STD : 문자열)에 '. PlayerShip.cpp :(텍스트 + 0x604) al_destroy_sample' PlayerShip.cpp:(.text+0x64c): undefined reference to al_load_sample에 정의되지 않은 참조'오류 : collect2 LD 1 출구 상태

반환 AND NO이다 "정의되지 않은 참조/확인되지 않은 외부 기호 오류 란 무엇입니까? 무엇 일반적인 원인은 다음과 해결 방법을/그들을 방지? "나는 보통 대부분의 정의되지 않은 참조 오류의 원인을 알고

.이 질문은 내가 사용 알레그로 라이브러리에 따라 다릅니다. 여기

코드의 비트를 (의 나는 분명히) 전체 게임을 게시하지 않을거야 :

#include <allegro5/allegro.h> 
#include <allegro5/allegro_native_dialog.h> 

#include <allegro5/allegro_font.h> 
#include <allegro5/allegro_ttf.h> 
#include <allegro5/allegro_image.h> 

#include <iostream> 

#include "Game.h" 


int main(int argc, char *argv[]) 
{  
    const char errorType[] = "Initialization Error"; 
    const int flags = ALLEGRO_MESSAGEBOX_ERROR; 

    // Initialize Allegro 
    if (!al_init()) 
    { 
     const char message[] = "Failed to initialize Allegro Library."; 
     //al_show_native_message_box(nullptr, "Error", errorType, message, nullptr, flags); 
     return -1; 
    } 

    Game game; 

    // Initialize a new window for gameplay. 

    int screenWidth = Game::GetScreenWidth(); 
    int screenHeight = Game::GetScreenHeight(); 

감사합니다 사전에 어떤 도움을

+0

의 사용 가능한 복제 [? 정의되지 않은 참조/확인되지 않은 외부 기호 오류가 무엇 내가 그것을 해결 어떻게 (http://stackoverflow.com/questions/12573816/what-is-an-undefined -reference-unresolved-external-symbol-error-and-do-do-i-fix) –

답변

2

Alegro은 여러 모듈에 걸쳐 그 기능을 분할 귀하의 pkg-config 라인을 사용하고있는 모든 모듈을 포함해야합니다!. 시도하십시오. 때문에 :

pkg-config --libs allegro-5 allegro_font-5 allegro_image-5 allegro_ttf-5 
관련 문제