Running a GLUT application in OS X

Discussion in 'Mac Programming' started by cossie, Jan 1, 2008.

  1. cossie macrumors member

    Joined:
    Aug 8, 2006
    #1
    Hi,

    I've written a pretty straight forward GLUT app in XCode, it compiles and runs fine when I'm in XCode.

    I built the executable version of it, so I now have the .app file.

    When I go to click on the file to run, it does nothing, an icon briefly flashes up in the dock and then disappears. I've also tried running it from a terminal but nothing happens at all.

    My previous development background is mostly Windows and Visual Studio based so I may be missing something in the build of the release, but I really don't think I am.

    Any tips would be great!

    Cossie
     
  2. Eraserhead macrumors G4

    Eraserhead

    Joined:
    Nov 3, 2005
    Location:
    UK
    #2
    What does the console say? This is in Xcode==>Run==>Console if you are running it in Xcode or /Applications/Utilities/ if you aren't running it in Xcode.
     
  3. cossie thread starter macrumors member

    Joined:
    Aug 8, 2006
    #3
    I completely forgot to look at the console output!

    I fixed the problem, it was incredibly thick of me, I was testing out if you could pass arguments / parameters to an glut application, which worked fine in Xcode because I could go "Project > Edit Active Executable..." and add the arguments there. So stupid of me not to cop on to that! :(

    Which leads me to my next question, is it possible to pass arguments to an application in OS X?

    I know how to do it in XP, simply by editing the shortcut or running the program from either the Run prompt or a DOS prompt.
     
  4. cossie thread starter macrumors member

    Joined:
    Aug 8, 2006
    #4
    It's cool, I figured out how to do it :)

    Code:
    ApplicationName.app/Contents/MacOS/ApplicationName arg1 arg2 etc
     
  5. sord macrumors 6502

    Joined:
    Jun 16, 2004
    #5
    You can also do it via the open command.
     
  6. stupidregister macrumors member

    Joined:
    Sep 29, 2007
    #6
    How would you pass the arguments through the open command?
     
  7. sord macrumors 6502

    Joined:
    Jun 16, 2004
    #7
    Just as you would think. For example if I want to open song.mp3 with QuickTime, I would:
    Code:
    open -a "QuickTime Player" song.mp3
     
  8. stupidregister macrumors member

    Joined:
    Sep 29, 2007
    #8
    I'm not sure if that actually passes an argument to the program in the command-line sense.

    If I do
    Code:
    /Applications/VLC.app/Contents/MacOS/VLC -h
    I get help text outputted to standard out and VLC does not open, but if I do
    Code:
    open -a VLC -h
    VLC opens instead of help text being outputted.
     
  9. mduser63 macrumors 68040

    mduser63

    Joined:
    Nov 9, 2004
    Location:
    Salt Lake City, UT
    #9
    You're right, it doesn't. All the arguments in that example are to the 'open' command itself. -a tells it that the next argument is the name of the application to use to open the file, and song.mp3 is the argument that specifies which file to open. To actually pass arguments to QT Player itself (assuming it
    takes arguments, have no idea if it does), you'd invoke the executable directly something like (off the top of my head):

    Code:
    /Applications/QuickTime Player/Contents/MacOS/QuickTime\ Player arg1 arg2
    
    This actually can occasionally be somewhat useful, or at least convenient because if you invoke an app from the command line this way, log messages get output to the terminal window. That way you don't have to go into Console to find them.
     
  10. urchinsub macrumors newbie

    Joined:
    Nov 23, 2009
    #10
    Glut console program gets “EXC_BAD_ACCESS”

    Hi,
    I am having similar problems. I included the frameworks for Glut and openGL. I included some others as well for date/time/string handling. The console icon appears on the desktop but gets the “EXC_BAD_ACCESS” message in the error log and doesn't display.
    I would have tried posting this as a new thread, which I MAY do, but I can't figure out how. Actually a friend just told me now that I might not be able to while they evaluate if I'm a bot.
    Thanks for your help.
     

Share This Page