AAAAAGGGGHHHH!!!!!! Xcode help!!!!!

Discussion in 'Mac Programming' started by unknown.exe, Sep 22, 2007.

  1. unknown.exe macrumors member

    unknown.exe

    Joined:
    Sep 22, 2007
    Location:
    Somewhere on Earth
    #1
    This is soooooo frustrating!This is the situation:
    I just made a C++ tool (because it was the only C++ thing in the "new project" window), then i wrote my code, and when i build it, it works fine. The program does what i want it to do. But now i want to turn the program into a stand-alone application. I already have the .icns file and i know how to add an icon to my program. I made a new target, and when it asked me what type of target i wanted, i chose a carbon application (because there was no "C++ application", and carbon is C++ isnt it?). So it made a new target, and in the panel below my original target (the one that looks like a lego block), it made a new target. So i put the source code from the first target into the new one, and the frameworks and my .icns file for the icon. When i click build it says that it was successful! Yippee!!! Im all happy thinking that i have made my stand-alone app! But when i go to the build folder for my program and open the application... the icon bounces up and down in the dock like it's starting, then goes away. Please someone tell me what i am doing wrong!!! This xcode thing is really confusing. Do i need to make a .nib (interface) file? Cause if I do, then i know how to DESIGN the interface... but i have no idea how to program it so that it works with my program. How do i do it?
     
  2. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    You can't just take some random C++ and hope that it will work as a full Mac app that you can launch via double clicking. Double clickable apps must conform to the expected interface, either via Carbon or Cocoa startup routines. If you want an app that you can double click you are better starting with the correct target: Cocoa or Carbon app.

    And from my understanding a lot of Carbon is procedural C, not C++...
     
  3. Nutter macrumors 6502

    Joined:
    Mar 31, 2005
    Location:
    London, England
    #3
    All of it, I think.
     
  4. Soulstorm macrumors 68000

    Soulstorm

    Joined:
    Feb 1, 2005
    #4
    Carbon can be used with C and C++, as long as the main files are named .cpp. The compiler will use the proper language according to file extensions.

    As for the original quetsion... you can't just throw a .nib file into a C++ tool and expect it will work. In order to make a Carbon application, you will need to make a Carbon Application in the New Project dialog, then assiciate your code with the .nib interface (yes, you will have to design that, too).

    What type is your program? Do you really need an interface? Do you know how to make one? Have you ever made one in any platform?

    I suggest you read Apple's documentation on Carbon and XCode before you start walking blindly.
     
  5. unknown.exe thread starter macrumors member

    unknown.exe

    Joined:
    Sep 22, 2007
    Location:
    Somewhere on Earth
    #5
    Reply

    My program asks about 8 or 9 questions which you answer. All I want is a window to open with a text box that my program's questions and the users answers appear in... thats all. Yes I need an interface because I am trying to get the hang of doing everything with xcode (I have used Visual C++ for the past 6 years). I have already DESIGNED an interface using the prog that came with xcode, and I've already got an icon. So all I need is a little instruction on the matter.:apple:
     
  6. Soulstorm macrumors 68000

    Soulstorm

    Joined:
    Feb 1, 2005
    #6
    I wish I could help you more on how to connect the interface elements with the actual code, but it's been a while since I gave up on Carbon in favor of Cocoa... Maybe Apple's documentation can help.
     
  7. Littleodie914 macrumors 68000

    Littleodie914

    Joined:
    Jun 9, 2004
    Location:
    Rochester, NY
    #7
    If you're trying to get used to doing everything in XCode, why use C++?

    It sounds like your program would be much easier to write if you wrote it in Objective-C, as a Cocoa Application. :)
     
  8. HiRez macrumors 603

    HiRez

    Joined:
    Jan 6, 2004
    Location:
    Western US
    #8
    I agree, using C++ with Cocoa is like trying to eat soup with a fork. You'll probably get fed eventually, but it won't be fun getting there.
     
  9. unknown.exe thread starter macrumors member

    unknown.exe

    Joined:
    Sep 22, 2007
    Location:
    Somewhere on Earth
    #9
    very funny... but ive been learning how to program in c++ and java simutaniously for the past few weeks, and i dont feel like learning c at all. yes i know that c is like c++, but ill have to learn a lot of different stuff. is there a way to program a .nib file to work w/ a prog? how?
     
  10. Eraserhead macrumors G4

    Eraserhead

    Joined:
    Nov 3, 2005
    Location:
    UK
    #10
    Can't you use Objective C++ to do it?


    You may be able to use Objective C++ but unfortunately you'll probably need to write some Objective C as well. To do that I suggest you pick up Aaron Hillegasses Cocoa Programming for Mac OS X to learn the basics of Cocoa.

    Its important to remember that once you know one language learning others isn't actually difficult.
     

Share This Page