質問

I've been struggling for a couple of hours now trying to link Allegro 5 to Eclipse on Ubuntu. And yes, I've been searching for it but I must be missing something really simple and you guys will surely find it right away, so please help me out...

I create the project like this: enter image description here

And when I try to link any library (example below) enter image description here

I get this error when compiling my program! enter image description here

And here is a pic of the relevant folders with the correctly compiled libraries: enter image description here


EDIT:

If you are struggling with this as well, all I had to do was very simple, you just need to add these to you libraries: enter image description here

here is the list so you can just copy and paste it:

allegro
allegro_acodec
allegro_audio
allegro_color
allegro_dialog
allegro_font
allegro_image
allegro_main
allegro_memfile
allegro_physfs
allegro_primitives
allegro_ttf

役に立ちましたか?

解決

You should get out of eclipse and just use the command line until you have this sorted. Eclipse is just a complex way to obfuscating the command line.

To link a .so, you need:

  • -LpathToLibrary
  • -lnameOfLibrary, with 'lib' and '.so' stripped off.

If your library is sitting in /usr/lib, which is suggested by what you are trying, then you don't need the -L at all. If the name is 'liballegro5.so', you'll need -lallegro5.

I recommend:

find /usr -name liballegro.so -print

if the answer is '/usr/lib/liballegro.so', then all you need is -lallegro.

If the answer is /SOMETHINGELSE/liballegro.so, then you need -L/SOMETHINGELSE/.

If you don't find liballegro, then you need to figure out if it's actually liballegro5.so.

You can also stop using -L and -l and just put the entire path of the .so in there.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top