Running a GLUT application in OS X

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

  1. cossie macrumors member

    Aug 8, 2006

    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!

  2. Eraserhead macrumors G4


    Nov 3, 2005
    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

    Aug 8, 2006
    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

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

    Code: arg1 arg2 etc
  5. sord macrumors 6502

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

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

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

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

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


    Nov 9, 2004
    Salt Lake City, UT
    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):

    /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

    Nov 23, 2009
    Glut console program gets “EXC_BAD_ACCESS”

    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