XCode and FLTK

Discussion in 'Mac Programming' started by jCrabb13, Apr 8, 2010.

  1. jCrabb13 macrumors newbie

    Joined:
    Apr 8, 2010
    #1
    First time poster on macrumors. It seems like XCode cant find any of my FLTK files...the error is:

    FL/Fl.h: No such file or directory

    The compiler makes it look like its looking in my file for the program, and therefore cant find the FLTK headers. Does anyone know where they need to be located to be used in XCode projects? i installed based on this website

    http://fltk.darwinports.com/
     
  2. chokma macrumors newbie

    Joined:
    Mar 14, 2009
    #2
    You'll need to add the directory containing FL/Fl.h to your include directories. To do this, choose Get Info from the context menu of your target. Then choose the Build tab. Add the directory containing FL/Fl.h (likely /opt/local/include) to the field "Header Search Paths".

    You'll also need to link against the library properly. Under the General tab (next to Build), on the Linked Libraries list, add your libfltk.a, likely from /opt/local/lib.

    That should let you build and link against FLTK. But why use FLTK when there's Qt?? :)
     
  3. jCrabb13 thread starter macrumors newbie

    Joined:
    Apr 8, 2010
  4. jCrabb13 thread starter macrumors newbie

    Joined:
    Apr 8, 2010
    #4
    I'm bringing this thread back from the dead. I am again trying to do FLTK on my mac (again for school) and I have this warning:

    warning: in /opt/local/lib/libfltk.a, file was built for unsupported file format which is not the architecture being linked (x86_64)

    and I'm pretty sure that is also the reason for my 7 errors, that all say:

    ((various fltk function/variable)) referenced from: _main in main.o

    somebody help me with this crap please!
     
  5. lloyddean macrumors 6502a

    Joined:
    May 10, 2009
    Location:
    Des Moines, WA
    #5
    For the error message I'm assuming you've MacPorts installed.

    Try this from the Terminal:

    sudo port upgrade fltk +universal

    If it complains it's not installed replace the 'upgrade' with 'install'.

    Once that's completed try rebuilding your project and seeing if the correct architecture was produced by MacPorts.
     
  6. jCrabb13 thread starter macrumors newbie

    Joined:
    Apr 8, 2010
    #6
    alright well since its been a while i did some more googling and FLTK really upgraded there website! look what i found :)

    http://www.fltk.org/articles.php?L979+I20+T+P1+Q

    and then i did what the last guy suggested in Terminal:

    sudo port upgrade fltk +universal

    and now I am getting this linking error when i open up the project template:

    Undefined symbols:
    "_AudioServicesPlayAlertSound", referenced from:
    fl_beep(int) in libfltk.a(fl_ask.o)
    fl_alert(char const*, ...)in libfltk.a(fl_ask.o)
    ld: symbol(s) not found
    collect2: ld returned 1 exit status
     
  7. lloyddean macrumors 6502a

    Joined:
    May 10, 2009
    Location:
    Des Moines, WA
    #7
    So add "AudioToolbox.framework" to the project and rebuild it!
     
  8. jCrabb13 thread starter macrumors newbie

    Joined:
    Apr 8, 2010
    #8
    no idea what that is...lol

    but i found it :)
     
  9. lloyddean macrumors 6502a

    Joined:
    May 10, 2009
    Location:
    Des Moines, WA
    #9
    Is this a Xcode project file or are you compiling things through the CLI?
     
  10. jCrabb13 thread starter macrumors newbie

    Joined:
    Apr 8, 2010
    #10
    xcode. i made the project template to where it will automatically integrate FLTK so i can make new projects for my piddly weekly homework assignments.
     
  11. lloyddean macrumors 6502a

    Joined:
    May 10, 2009
    Location:
    Des Moines, WA
    #11
    Does the list on the left side of your project have a folder name Frameworks? If so right click and select "Add" -> "Existing Frameworks". You'll be presented with a file selection dialog. Locate and "add" the "AudioToolbox.framework" to the project and rebuild.
     
  12. jCrabb13 thread starter macrumors newbie

    Joined:
    Apr 8, 2010
    #12
    ya i found it. thanks for your help!
     
  13. lloyddean macrumors 6502a

    Joined:
    May 10, 2009
    Location:
    Des Moines, WA
    #13
    Be kind enough to let me know if you've gotten it to work.
     
  14. jCrabb13 thread starter macrumors newbie

    Joined:
    Apr 8, 2010
    #14
    ya its working!
     
  15. jCrabb13 thread starter macrumors newbie

    Joined:
    Apr 8, 2010
    #16
    yup yup the little basic window pops up and everything.
     
  16. lloyddean macrumors 6502a

    Joined:
    May 10, 2009
    Location:
    Des Moines, WA

Share This Page