Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6921105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:14:00+00:00 2026-05-27T10:14:00+00:00

I recently compiled Allegro-5.0 from source (following the instructions from the wiki). I didn’t

  • 0

I recently compiled Allegro-5.0 from source (following the instructions from the wiki). I didn’t get any errors during the process, so I assume it went well. However, I am getting linker errors with even the most minimal test programs:

//test.cpp
#include <allegro5/allegro.h>

int main()
{
    al_init();
    return 0;
}

I am compiling with

g++ `pkg-config --libs allegro-5.0` test.cpp -o test

But I always get

/tmp/ccVmmERa.o: In function `main':
test.cpp:(.text+0xf): undefined reference to `al_install_system'
collect2: error: ld returned 1 exit status

(pkg-config returns -L/usr/local/lib -lallegro, there doesn’t seem to be anything wrong with that)

Also, I can compile the examples with the the given makefile just fine, so there doesn’t seem to be anything wrong with the library. I would just try to do the same thing the makefile does to make it work, but I don’t understand it at all (I can barely write my own simple ones).

Oh, and I’m using Ubuntu 11.10 and gcc 4.7, though I don’t think that has anything to do with it.

So – why does this happen, and how can I fix it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T10:14:00+00:00Added an answer on May 27, 2026 at 10:14 am

    Put the libs last on the command line:

    g++ test.cpp -o test `pkg-config --libs allegro-5.0`
    

    When linking, the order of the files and libraries matter.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to Mono and just started recently. Is mono program are compiled from
Recently I downloaded Live555 server source code from their site. I tried to compile
I recently downloaded new linux kernel source code and compiled on ubuntu. After my
I've recently compiled Clang and LLVM on Windows. My goal is to use it
We have a few different programs all compiled together in the same suite, recently
I was recently fighting some problems trying to compile an open source library on
I recently got MySQL compiled and working on Cygwin, and got a simple test
I recently updated the Android SDK on the Jenkins machine to rev15 from rev13,
i have recently compiled new clang(3.1 now), and tried to use it for parsing
I recently received a closed-source SDK consisting of a C header file ( .h

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.