私は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.cppにテキスト+ 0x168)。:機能main': main.cpp:(.text+0x130): undefined reference to
al_show_native_message_box 'al_init_ttf_addon al_init_font_addon' main.cpp:(.text+0x164): undefined reference to
への未定義参照 main.cppに:(テキスト+ 0x160)' は:メニュー項目: 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つの終了ステータスを返し、NO THIS ISは、未定義の参照/未解決の外部シンボルエラーとは何ですか?一般的な原因とどのようにそれらを防ぐ/修正する何ですか?」
私は通常、ほとんどの未定義の参照エラーが発生するか知っている。この質問は、私が使用しているアレグロライブラリに固有のものです。
ここでは、コードのビットが(です私は明らかに)ゲーム全体を投稿するつもりはない:
#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();
感謝を事前に任意の助けのため
の可能性のある重複した[?未定義の参照/未解決の外部シンボルエラーとは何か、私はそれを修正しますか](http://stackoverflow.com/questions/12573816/what-is-an-undefined -reference-unresolved-external-symbol-error-and-do-do-i-fix) –