Question on Xcode

I am in the process of learning objective-c and am using xcode to do it. The book I am using has you create many examples using the main.m file. Should I be creating a new project for every single example? I definitely want to save them. Or is there an easy way to hold multiple main.m files in the same project, and be able to run them within xcode? I have gotten other targets and such on there, but when i click run it always runs the original main.m. Please help. Thanks.

Use the File Inspector to alter the target membership of the main.m you want.

Similar Messages

  • Hello , how r u,  can i ask 1 question about xcode, i have mac os x 10.7.5 , n xcode version 4.6.3 i want build apps for ios 7.1 n mac os 1.9 ,, , but my macbook is old late 2008 macbook 4,1,  so can i develop apps for ios7 n 1.9 using xcode 4.6.3, bcz my

    hello , how r u,
    can i ask 1 question about xcode, i have mac os x 10.7.5 , n xcode version 4.6.3 i want build apps for ios 7.1 n mac os 1.9 ,, , but my macbook is old late 2008 macbook 4,1,  so can i develop apps for ios7 n 1.9 using xcode 4.6.3, bcz my machine cant upadte on 1.8 n 10.9,, ihave 2gb ram . core 2 duo pr, plz rely asap,
    thnxs

    Please type complete sentences and words.  This isn't an instant message program.
    https://developer.apple.com/support/ios/ios-dev-center.html

  • 2 simple questions on Xcode for the experts out there

    hey.  I have just started programming in C++ and am getting good results in the command line tool in xcode.
    I am trying out my own programmes based on what I am learning from a C++ book.  However, there seems to be an issue with one of the things I have learned.
    Acording to the book I can use a getline statement to allow a user to input a string with spaces such as a whole sentence instead of one word.
    Well when ever I use getline, xcode reports no errors (build succeeded) however it always skips over the getline and moves to the next part of the code.for example,
    #include <iostream>
    #include <string>
    using namespace std;
    //This is just a random example.
    int main ()
        string first;
        string last;
        cout <<"what is your first name?";
        cin >>first;
        cout <<"what is your middle and last name?";
        getline (cin, last);
        cout <<"hello"  <<first <<" " <<last;
        return 0;
    if it is my code please say.  But xcode only excepts my first name then skips right to hello. 
    It does not pause to let me input middle and last.  How can I fix this?
    Second question is I am viewing everything in the debug console.  How do I get my code to run in terminal?
    Thank you so much to everyone that answers.

    Saad Attieh wrote:
    So how do I get this to run in terminal.app? Will it run any differently?
    That is how I ran it. It runs the same.
    The easiest way is to just inspect the build output , find the temporary path it uses, and go there. For simple programs like this, you can just type them in with vi and compile with clang++.
    Oh yeah and do you know if and how I can use c++ to create a full application in Xcode?  As in what template do I choose?  According to the user guide I have to choose a carbon application template or something like that if I want to make a application with the usual quit and minimise etc buttons.  But I cannot find that so I am feeling very silly.
    Also, looking a head into the future what are the best languages to use for coding in Mac OS X?
    You should use Objective-C for building MacOS X programs. If you are building command line tools or libraries, you could just use C++. There isn't anything on the Mac that requires C++.
    If you really wanted to, you could write the Mac parts in Objective-C and your own routines in C++ and connect them with C linkage. Another option would be to use Objective-C++. The core operating system and especially user interface libraries are all designed for Objective-C. It isn't smart to fight against the system.
    In practice, C++ is just an awful language. Anything you might want to use C++ for can be more easily done in Objective-C. I spent 15 years writing C++ software. I really enjoyed it, but I realized that I enjoyed it because it was hard - like a puzzle. That approach isn't conducive to effective software development.

  • Question for Xcode 4.5.2

    mac os x 10.8 with xcode 4.5.2  ,   when i created a new project and ran it , there are some questions....
    Crashed Thread:  0  Dispatch queue: com.apple.main-thread
    Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
    Exception Codes: KERN_PROTECTION_FAILURE at 0x00007fff52c5bff8
    How can i solve the question....

    Coding questions are best asked in the Developer community. I'll ask the hosts to move this.
    But I can tell you that given the information you supplied there is no way the question can be answered. You'll need to explain what you were doing and supply the code causing the crash as a minimum.

  • Question about Xcode

    My mom has recently purchased a mac, so im probaly going to start learning how to make mac programs. One question I have is what is Mac's equevelent to system.net.sockets? Is there one or do I have to use a 3rd part socket library? Also are there any good openGL tuts using Xcode? Thanks.
    Mac > Windows

    Brian J Irvin wrote:
    One question I have is what is Mac's equevelent to system.net.sockets? Is there one or do I have to use a 3rd part socket library?
    The Mac uses POSIX sockets, which is Windows sockets are trying to emulate. You now get the real thing. If you want a higher-level API, you can use things like NSInputStream, NSFileHandle, and CFSocket, just to name a few.

  • Question about Xcode from experienced Mac users

    Hi,
    I am new to Macs.Recently I found an issues where the finder copy certain files such as .DS_Store whenever I access a network share. I tried to use a command through the terminal but it didn't work. I called apple to ask if there was any way I could view the value of the com.apple.desktopservices preference (sorry if this is not the name) and they told me to install Xcode so I could see it.
    I am a network engineer but I could like to know how I could get benefit from Xcode. What does it do? Is there a way to access the same information using terminal?
    I would like to learn a bit more about things that can be done using the command interface. I would appreciate if you send me some links or recommend any books (for simple stuff)
    Thanks in advance for your opinion.
    Macbook C2D   Mac OS X (10.4.8)  

    Hello and welcome to Mac.
    Your ".DS_Store" issue is not really an issue, OSX creates the file wherever it goes. You can remove existing .DS_Store files on a volume of your choosing with this Applescript:
    Click here to launch Script Editor.
    display dialog "When you delete .DS_Store files, you will lose window size and icon arrangement for EVERY FOLDER on the target disk. Furthermore, if you had any Spotlight comments (a.k.a.Finder comments) associated with any files, they'll also be deleted"
    set mountedDisk to POSIX path of (choose folder)
    tell application "Terminal"
    if (count of windows) is 0 then do script ""
    delay 0.1
    do script "find " & quoted form of mountedDisk & ¬
    " -name .DS_Store -delete" in front window
    end tell
    Everyone you talk to at Apple is an idiot, don't waste your time. Preference files are binary files for faster reading and writing by software. Xcode contains an application called "Property List Editor" that translates the plist files from and to editable XML files when you open them. Believe it or not, you can download the application from this page:
    http://Gnarlodious.com/Computer?action=AttachFile
    But there are ways to write the preference to the file without editing it. You can persistently disable the creation of the offending files with this Terminal command:
    defaults write com.apple.desktopservices DSDontWriteNetworkStores true
    As for Xcode, it is for programmers. There isn't much value in it for a sysadmin. Terminal, however, should become your main tool. You can convert a binary plist file to XML with this Terminal command:
    plutil -convert xml1 ~/Library/Preferences/com.apple.desktopservices.plist ; cat ~/Library/Preferences/com.apple.desktopservices.plist
    That is actually two commands, the first converts the file, the second writes it to the Terminal. After editing it, you would convert the same file to binary with this command:
    plutil -convert binary1 ~/Library/Preferences/com.apple.desktopservices.plist

  • Real NOOOOB C++ question for Xcode

    Hi. I'm learning C++ in college and I've been using Visual Studio. We will be working using console applications and I would like to know if I can code those using Xcode rather than VisualStudio.
    I have installed XCode, and see options for Cocoa C++, etc but don't know which I should select.
    If anyone can give me a 1-2-3 step process of creating the project, creating the cpp file, then compiling/running it, I would appreciate it.
    First I'd just like to get something simple to work:
    #include <iostream>
    using namespace std;
    int main()
    cout << "Hello World";
    system("pause");
    return 0;
    Thanks,
    Bryan

    Short answer: Create a C++ Tool project.
    For a walkthrough of a creation of a C++ Tool Xcode project, go to the following URL:
    http://www.meandmark.com/articles.html
    Read the Introduction to Xcode article.

  • Xcode diverse questions.

    Hello, looking to be a app developer, and I have a few questions about Xcode before I bug Apple. Xcode, as I am informed, runs on Panther, (beleive 1.5 does, or could you tell me the most recent one that will run on Panther? I know Panther is ancient, but thats what I'm running now on my old Powerbook, and I don't want to upgrade till I'm sure I'll be doing this. Also, could you tell me the main differeces between Xcode for Snow Leopard and Xcode for Panther? Thanks alot.

    I would like to tell you definitively the most recent version of Xcode that will run on 10.3, but Apple's "All downloads" site for developers is down right now. I think it is 2.2 or maybe 2.5. Regardless, there are extensive changes between the older Xcodes and Xcode4. Plus, the older Xcodes are from before Xcode development really "took off", so you will have a difficult time finding books or documentation. The hardest part is building the user interface with Interface Builder. That has changed several times over the years and when it says "control-drag from X outlet to Y object" you may be lost if you don't have the exact version of Xcode that matches whatever tutorial you are using.
    There is quite a bit of information available for Xcode3, but Xcode4 has now been released and that is another significant change. The differences are primarily platforms and Interface Builder. Older Xcodes only support Mac development for PPC. Xcode3 can build software for iOS, PPC and Intel Macs, and is a pretty good stand-alone IDE. Xcode4 is focused on iOS and Snow Leopard Intel Macs.

  • Two basic xcode questions (tabs and displaying members)

    I have two questions about xcode that are most likely answered easily:
    1. Is there a way to set it so that selecting a block of text and hitting tab or shift tab will indent it instead of replacing it with a tab? I know that i can right click and do move right, but that is pretty irritating to do on a regular basis.
    2. How do I get xcode to display members of classes and structs when I am typing? For example if I type 'var->' I want it to pop up a list of available members that belong to var for me to choose from. Or if I type 'function(' i want it to list what the parameters are that function is expecting.

    I don't think that anyone much gives a flying fsck what "features" are available; unless that person is trying to "sell" something to you.
    Of course, I assumed your standards were based on what Micro$hite offers you. Why should that be a standard?
    If you want similar features, you will have to use a proprietary Apple API. Believe me, you can get it. But you cannot inspect MFC from inside Apple's IDE.
    I'm sorry, I don't really intend my remarks to be harsh. It just astonishes me when people don't realize that these folks are not in business to HELP YOU but are in business to MAKE MONEY.
    I'm not even saying this is wrong. I'm just saying, you should not be astonished.

  • [Xcode 4.0.1] Internal error installing Mac OS X 10.6 core library

    Hi folks, this is on a clean 1-month old mac running 10.6.7, with a fresh install of Xcode 4 from the app store. The "documentation" tab in the options allow you to install the mac os 10.6 core library documentation. It downloads the package but fails to install it. Here's the error:
    "Internal error installing Mac OS X 10.6 Core Library". Install process rejected install attempt.
    What can be done to fix this? Thanks.

    http://stackoverflow.com/questions/5658693/xcode-4-0-1-internal-error-installing -mac-os-x-10-6-core-library
    step 1 : Exit XCode And Remove Old Mac OS X 10.6 Core Library.
    Default Position :
    /Library/Developer/Documentation/DocSets
    File Name :
    com.apple.adc.documentation.AppleSnowLeopard.CoreReference.docset
    step 2 : Download Again.
    Open XCode And Select Menu XCode / Preferences... / Documentation,
    get Mac OS X 10.6 Core Library(661 MB) Again.
    ps : In Fact, file size is 1.31 GB, Not 661 MB

  • How to run c program without xcode

    i want to run my c program without using Xcode coz its a huge download,plz help me out I'm new to mac

    The Xcode install is worth the time and space (in my opinion).  To enable the command line tools you have to also install those:
    http://stackoverflow.com/questions/9329243/xcode-4-4-and-later-install-command-l ine-tools
    The nice thing about using Xcode is that you will have the debugger and also be able to build executables for other platforms (cross compile) since Xcode allows you to use an external build system.
    Here is another option... there are websites that allow you to compile and run code on the server side (through a web interface):
    http://ideone.com/jwTjgN

  • Installing gcc without xcode?

    How can my students install the command-line gcc compiler into Lion without having to download the entire, huge xcode environment from AppStore?
    (up to 2-hour download)

    I would consider a different roll-your-own strategy; if you're going to invest in this effort, it's usually best pick your battles.
    You're clearly trying to optimize for network bandwidth, but at the cost of an older compiler (Clang is the path forward for Mac OS X, and not gcc) and at maintaining that part of your students' environments yourself, and at dealing with the usual errors and weirdnesses, and at an approach that's not integrated with Xcode; most industry work now arises with an IDE of some ilk. 
    Obviously you know your curriculum and your available time here for IT, of course.
    Here, I'd move to an approach based on mastering the entire Mac OS X installations, and loading those into the students' systems, and I'd incorporate the standard kits into the master including (for this case) Xcode.  There are other advantages here, too.  If something goes wrong with the student's environment or a disk fails or... you can blow away the contents and reload the master.
    For some discussions of mastering and managing your own distributions, see the MacEnterprise mailing list and mailing list archives, among other resources.  (With a server, you can run most of this stuff on-line.  Also hosting Apple software updates via Mac OS X Server and Software Update Services, or via Linux with the Reposado package, to cut down your bandwidth requirements.)
    It's also potentially possible to use a different distributions here as part of your mastering; check with Apple around the availability of that.
    And if these arem't your school's Mac systems, there's a whole 'nother discussion here around managing the Apple Ids and related on these systems.  (There are some of those discussions on the MacEnterprise list, as well.  Check the mailing list archives, among others.  It's a goldmine for these sorts of questions, and Xcode has specifically been discussed at length.)  

  • Xcode no remotes found

    So I setup XCode 4.4 to use git on a local repository. That's working. Now I want a remote repository so I added a bare repository on another machine on the local network using the git command line. That worked, I can see the repository in the Finder on the remote machine and can see its internal structure. I added the repository to the project in the Organizer window. When I select Remotes I see my remote repository.
    In the Organizer when I select the Remotes under my project I see one entry in the right hand list, when I select that entry I see the login credentials and the path, <ssh://[email protected]/path/to/repo/myRepo.git>. The reomte machine is online and reachable.
    But when I select File/Source Control-?Push the popup in the alert sheet says "No remotes found".
    Google found another couple of people with the same issue, but no answers.
    Thanks,
    Brian

    I'm having this same exact problem with xcode 4.4. For me, remotes do not work for repositories at beanstalkapp.com but they do work for github repo's. These same repositories work completely fine via command line pushes.
    http://stackoverflow.com/questions/11724847/xcode-4-4-no-remotes-found#comment15 786270_11724847

  • Xcode build error

    Hey, i get this error on build:
    error: PCH file built from a different branch ((clang-425.0.24)) than the compiler ((clang-425.0.27))
    Any ideas on how to fix?
    - Thanks, Kez.

    I had the exact same problem, but only with command line builds (xcodebuild).
    So after doing some cleanups (and even Clean Build Folder (Alt key on Menu: "Product"  > "Clean Build Folder...") the only thing that worked for me was:
    http://stackoverflow.com/questions/7071523/xcode-4-1-fatal-error-stdlib-modified -since-the-precompiled-header-was-built#comment18214650_7072227
    So, "touch" you PCH file first and retry.
    Cheers,
    Carlos

  • Xcode main.c File type is Puzzling

    Howdy,
    In working through a C kinda book, I created several C projects. They run fine via Xcode and terminal using clang works fine on the main.c file. However while in terminal I ran the file command on the main.c file and got:
    file main.c
    main.c: ASCII C++ program text
    I was expecting something along the lines of ". . . C program text".
    So I tried:
    $ clang++ main.c
    clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated
    Interesting note, if I go into the project folder, duplicate and rename the copy to main.cpp, using clang++ works fine; no warning message
    So my question --- is Xcode really creating a c++ file even when C was selected when making the project?  Just curious.

    In the first case, the "file" command is an old UNIX tool that uses definitions in /usr/share/file/magic. It doesn't have any other meaning for the system. See the magic directory and/or "man file" for more information. In this case, it is confused by the "//" which it thinks indicate C++.
    In the second case, you are simply trying to compile a C file with the C++ compiler. Clang works just like GCC in this respect. When you add the "++", it adds all of the necessary flags and include directories for C++. Even if you wrote straight up C code, there are some subtle differences between C and C++.

Maybe you are looking for

  • VGA Adapter and 1920x1080

    I have an odd problem with my 2011 MBP (15").  I use an external monitor (Samsung SA350, identified as SMS23A350H by the mac) hooked up to a KVM switch using the VGA port.  The display support 1920x1080@60hz.  It gets detected as such, and everything

  • Name of  source directory?

    Hello, I created a communication channel in the integration builder (configuration). This should read a file from my local computer, so I choose as adapter type "file". But he didn't accept the source directory I like to use. I created a technical sy

  • Link to setup calendar subscription from web page or app?

    I have a web site that generates ical files (.ics). I'd like to put a link on a page that the user can click on which would launch the Settings->Mail, Contacts, Calendars->Add Account->Other->Add Subscribed Calendar area with the Server url pre-popul

  • How do I remove a white line between cells?

    I have navigation buttons setting on top of a header image. The nav buttons are in one row and the header image is in the row below it. I have all cell padding and margins set to 0 in CSS, however, I still get the thin white line between the nav butt

  • JTextField in a JPanel

    It's been a couple years since I worked with GridBagLayout. I'm trying to add a JTextField to a JPanel but it does not seem to be working - it ignores the GridBagConstraints fill and anchor, changes to the JTextField are only visible when resizing th