simple ques.: how to open new empty editor file in Xcode 4.0?

I use Xcode 4.0 as an editor for stand-alone C++ programs. In earlier versions, I would just open a new empty file (cmd-shift-N, I think; the new file option, which was just cmd-N, gave me something else) and start typing. But in v. 4.0, I haven't found the option to do this. Under File->New, it only offers me the option of new project or new workspace. There is an option for new file, but it's grayed out. So what I have to do now, to get a new empty editor file, is open an existing C++ program in Xcode, delete the contents, and save it under a new name.

2008 Macbook Pro 2.5 GHz, Mac OS X (10.6.8), 6 GB RAM, 240 GB OWC SSD

Posted on Jul 17, 2011 1:41 PM

Reply
14 replies

Jul 17, 2011 5:02 PM in response to K T

Thanks for the reply. Surprisingly, I don't have that as an option (I've attached a pic of what my File/New submenu looks like). So perhaps my question is not so simple [!], and should instead be: why doesn't my submenu look like yours? It couldn't be because I have v. 4.0 (Build 4A304a) rather than 4.0.2, could it? Did I need to do something special when I installed it?User uploaded file

Jul 17, 2011 6:01 PM in response to xnav

Alas, that doesn't work either (I had already tried that). When I click on the Empty Icon I don't get an empty file. Instead, I get a dialog box asking me to create a project. Then when it's finished I get this:User uploaded file

Now, once I've done this, THEN I can do (because it's no longer grayed out) File/New/New File/Other/Empty (so this, at least, now explains why my submenu looked different from K T's: he must already have had a project created, while I had not). But besides having all these unnecessary steps (since I have no interest in creating a project), it still doesn't give me just the simple text editor I used to be able to get; instead I get this more complicated-looking window with what looks like a debugger, which I'm not using:

User uploaded file


On the other hand, if I open one of my existing C++ programs in XCode, then I do get just exactly the type of text editor window I used to be able to get just by directly doing cmd-shift-N. So does anyone know how to get to this directly, without creating a project, etc.?:

User uploaded file

Jul 17, 2011 6:17 PM in response to xnav

xnav: Yes, that's correct, and what you're recommending is equivalent what I've been doing. But it's real kludgey to have to do the extra steps each time, particularly if you're creating lots of small C++ test programs. So what you're saying is that XCode no longer has the capability to just create (from the menu) a simple text editor file like it used to?


K T: so you're saying that your version can do exactly what I asked (create a simple text editor file, without the debugger interface, as pictured immediately above) without having to first build a project?

Jul 17, 2011 6:24 PM in response to K T

OK, I will do that and report back!🙂

[Normally I would have just updated to the latest version before posting, but reinstalling XCode's a bit more involved for me (e.g., to save space on my SSD I'd moved the install program elsewhere after installation, so I have to retrieve it; then there were some authorization issues with Apple, etc.), plus I'd recalled reading differences between 4.0.2 and 4.0 just had to do with installation failure problems, not functionality; just wanted to let you know I wasn't being lazy.]

Jul 17, 2011 8:13 PM in response to K T

OK, K T, I did what you asked. I now have the same build as you (4.0.2 • 4A2002a). And I find the behavior is . . . unchanged! I can get the same window you pictured in your last email (as I could before). But as I stated earlier, I can't get there unless I've first created a project. And, when I click on Empty, I get a window that looks like the second picture in my above post, not the third.

Jul 17, 2011 8:41 PM in response to xnav

Nah, rather not risk it, since I'd only want to change the editor, while leaving the rest of the package, which includes the latest compilers, alone. Since XCode is complex, there may be links/compatibilities between the editor and the rest of the package that I could damage. And I don't want to make a research project out of it. So unless someone else chimes in, it looks like I have my answer: Xcode 4 doesn't do what I want, so I'll just have to keep doing what I've been doing which was essentially equivalent your earlier suggested solution.

Jul 17, 2011 9:53 PM in response to pchemist

I should add that one other bit of odd/inconvenient behavior is that if I do open a stand-alone C++ file this way, work on it, save it, and close it, when I do File->Open Recent there's nothing there, except once when I saw all my recent files (and I don't know what I did differently then....). I'm guessing it just doesn't like files that aren't part of a project.

Jul 19, 2011 12:08 PM in response to pchemist

I'm guessing it just doesn't like files that aren't part of a project.

Correct. As you've discovered Xcode 4 only lets you add new files to a project.


If you want to use Xcode 4 as an editor only, you have two options. One, create an empty Xcode project and add your files to the empty project. Two, create the source code file in another text editor and open the file in Xcode from the Finder. Opening the file from the Finder opens the file in its own editor.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

simple ques.: how to open new empty editor file in Xcode 4.0?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.