Carbon question

Discussion in 'Mac Programming' started by pinsrw, Aug 15, 2010.

  1. pinsrw macrumors regular

    May 30, 2010
    Hi all,

    I need to do some old fashioned C-based Carbon coding, and I'm having a little problem. My program is coded I think normally, and when I put the executable into, and invoke it by double-clicking on, everything works fine... The app window comes up and my graphics is displayed.

    However when I try running my executable from the command-line, the window comes up blank and is behind other windows. Can anyone here with Carbon knowledge hazard a guess as to why this might be and how to fix it?

  2. lloyddean macrumors 6502a

    May 10, 2009
    Des Moines, WA
    You need to use the 'open' command at the terminal to launch application bundles.

    open -a TextEdit

    Will launch the TextEdit application. No need to provide the .app extention.

    Unless the application is in your path try using:

    open -a path/to/your/appbundle
  3. pinsrw thread starter macrumors regular

    May 30, 2010
    Now I'm getting stranger results than before. When I do this:

    $ open 
    It produces the same blank window in the background but it also products a Terminal with some minor shell errors printed.

    When I do this I get an error and no application window appears:

    $ open -a 
    Unable to find application named ''
  4. lee1210 macrumors 68040


    Jan 10, 2005
    Dallas, TX
    Point to the bundle with open, not the executable in the bundle.

  5. pinsrw thread starter macrumors regular

    May 30, 2010
    Well yes, doing "open ./" works fine.

    But I want to run the executable like so
    $ cd ; ./my
    ... ignoring the bundle.

    I know that this is possible, because some GUI-based executables do run OK from the command-line. For instance, I can already do this with another application that I wrote, but it's one where the GUI subsystem is a library that I borrowed (kind of like wxwidgets), thus I didn't write its GUI initialization. I'm left wondering how they coded it such that one can run the executable from the command line.
  6. Big Dave macrumors 6502

    Nov 27, 2007
    Crestview, Fl
  7. pinsrw thread starter macrumors regular

    May 30, 2010
    It comes up behind the Terminal window, but its contents are filled in.
    Also the application list (command-Tab) does not show it.
    Any ideas?

Share This Page