can't get allegro to work

Discussion in 'Mac Programming' started by dancks, Sep 23, 2011.

  1. dancks macrumors member

    dancks

    Joined:
    Nov 8, 2009
    #1
    OK So I followed the instructions listed here:
    http://wiki.allegro.cc/index.php?title=Install_Allegro5_From_SVN/OSX

    no problems with the download or install but I did get a few warnings about DUMB, PhysicsFS and some other stuff I assumed were the optional support libraries. I go to compile a test program on the Desktop and boom: Couldn't find Allegro.h. No idea whats going on I just assumed allegro would be available.
    I compiled with:

    gcc myfile.c -o myprogram `allegro-config --libs`

    from:

    http://alleg.sourceforge.net/stabledocs/en/build/macosx.html

    FYI I did not do the XCode install because quite frankly I don't like XCode. I'd rather do nano or TextEdit if I need to look at more than one piece of code at the same time. So all you fan boys find someone else to proselytize to. But push come to shove I'll try it out. I'll also try the other compile options as I was running late for something when I tried this so I'll give it a go later.

    ... wait wth is a backtick and how do I do it. But if I got that wrong why did it spit out the normal routine errors? Instead of not compiling?

    Honestly I'm just a newbie who would like to try out a GUI framework just to make it more fun.
     
  2. jiminaus macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #2
    As it stands you've only added the gcc flags for linking. You need to add the gcc flags for the headers files. Try adding --cflags to allegro-config. So your compile command would be something like this:
    Code:
    gcc myfile.c -o myprogram `allegro-config --libs [COLOR=red]--cflags[/COLOR]`
    The backticks substitute the output of a program for the backticks. If you run allegro-config --libs --cflags directly, the output will be a series of gcc command-line args.
     
  3. dancks thread starter macrumors member

    dancks

    Joined:
    Nov 8, 2009
    #3
    Tried it. same thing.

    I also noticed: allegro-config: command not found.

    I guess that means I didn't install allegro correctly D:

    But I didn't get any errors. So what would I try differently?

    I know this is linux but would any of the following on this page apply:

    http://www.linuxquestions.org/quest...-to-compile-a-c-file-cpp-with-allegro-387152/

    Because I know allegro was installed in its own folder in my home directory so the path is /users/me/allegro
     
  4. jiminaus macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #4
    I'd assumed you'd installed it so that allegro-config was on your path. If it's not, you need to specify the path to it.
    Code:
    gcc myfile.c -o myprogram `/users/me/allegro/bin/allegro-config --libs --cflags`
    
    I've assumed you've got the likes of bin, lib and include directories under /users/me/allegro.
     
  5. dancks thread starter macrumors member

    dancks

    Joined:
    Nov 8, 2009
    #5
    just an update:

    I tried:

    jdd:Desktop jasondancks$ gcc alleg2.cc -o alleg2 `/users/jasondancks/allegro/bin/allegro-config --libs --cflags`
    -bash: /users/me/allegro/bin/allegro-config: No such file or directory

    I looked there is no bin folder. IDK whats going on.

    oh yeah I managed to get a smiley to show up at the command line
     
  6. jiminaus macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #6
    What is in that folder?

    (Wrap stuff in NOPARSE tags to prevent smilies)
     
  7. dancks thread starter macrumors member

    dancks

    Joined:
    Nov 8, 2009
  8. jiminaus, Sep 23, 2011
    Last edited: Sep 23, 2011

    jiminaus macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #8
    That looks like the build folder. Did you run make install? When you configured, did you specify a prefix directory?

    EDIT:
    Okay. So I actually went ahead and actually built and installed allegro. It's allegro 5.0.4 from svn. There is not allegro-config. Where did you find about allegro-config?

    EDIT 2:
    So, there are pkg-config files under lib/pkgconfig. So this nefarious allegro-config would just be a wrapper around pkg-config. I ran the following and go this output.

    Code:
    $ export PKG_CONFIG_PATH=/Users/jasondancks/allegro/build/lib/pkgconfig
    $ pkg-config --libs --cflags allegro-5.0
    -I/usr/local/include  -L/usr/local/lib -lallegro
    
    So these are the flags you need to build with. The /usr/local is were it would be if it was installed, but if you want to build straight from the build directory, substitute that path.

    Code:
    gcc -I/Users/jasondancks/allegro/build/include -L/Users/jasondancks/allegro/build/lib -lallegro  -o myprogram  myfile.c
    
     
  9. dancks thread starter macrumors member

    dancks

    Joined:
    Nov 8, 2009
    #9
    I did "make install .." I'm pretty sure thats what I did. Not 100%

    Code:
    jdd:~ jasondancks$ export PKG_CONFIG_PATH=/Users/jasondancks/allegro/build/lib/pkgconfig
    jdd:~ jasondancks$ pkg-config --libs --cflags allegro-5.0
    -bash: pkg-config: command not found
    
    first line worked

    routine errors again. I'm gonna look for someone who's a mac expert to look at what I'm doing. The only other time I installed something directly from the source code was WXwidgets and IDK if it worked b/c... the learning curve was too steep for me. whatever.
     

Share This Page