Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

AustinWhite

macrumors newbie
Original poster
Sep 11, 2011
3
0
i just programmed my first "Hello world" Application in Xcode. so i ran the program and there were no errors but when i try to open the product all i see is a window with a grey box in the center that says "exec" in the top left of it. am i doing it wrong? I'm confused.

i just started teaching myself C++ today and i have absolutely no programing experience, so excuse my ignorance please
 
i just programmed my first "Hello world" Application in Xcode. so i ran the program and there were no errors but when i try to open the product all i see is a window with a grey box in the center that says "exec" in the top left of it. am i doing it wrong? I'm confused.

i just started teaching myself C++ today and i have absolutely no programing experience, so excuse my ignorance please

Every program has an icon. The program you created was most likely a "command line program" and the grey box with "exec" inside is the icon that the Macintosh uses for command line programs. So that is absolutely what is expected.

Command line programs don't contain any code to show them in a window. So if you double click it in the Finder you won't see anything that it does. You can start it from XCode (Command-R) or start the Terminal application and use standard Posix commands to start it. You'll probably want to run it from XCode.

Telling us which XCode version you are using is very helpful, because different versions of XCode behave different.
 
Which book or tutorial you're learning programming from? Be specific: title & author, or the URL of the online tutorial.
 
You need to view the console window by hitting Shift-Command-R or going to the 'Run' menu and choosing 'Console'

4d7v3.png


NLKIL.png
 
Which book or tutorial you're learning programming from? Be specific: title & author, or the URL of the online tutorial.

the book is called "Sams Teach Yourself C++ in One Hour a Day" by Jesse Liberty, Siddhartha Rao, and Bradley Jones

It seems like a pretty informative book so far

----------

Every program has an icon. The program you created was most likely a "command line program" and the grey box with "exec" inside is the icon that the Macintosh uses for command line programs. So that is absolutely what is expected.

Command line programs don't contain any code to show them in a window. So if you double click it in the Finder you won't see anything that it does. You can start it from XCode (Command-R) or start the Terminal application and use standard Posix commands to start it. You'll probably want to run it from XCode.

Telling us which XCode version you are using is very helpful, because different versions of XCode behave different.

I'm using the latest Xcode, 4.1.1 i believe.

so is there a different place in Xcode where I'm supposed to write a C++ program or is command line the right place to be.

Also, is Xcode the compiler that most people use on mac? or is there others that work better
 
In XCode 4, you need to show the console in the debug area. The easiest way to do that is to Shift+Command+C.
 

Attachments

  • Xcode4.png
    Xcode4.png
    184.8 KB · Views: 180
so is there a different place in Xcode where I'm supposed to write a C++ program or is command line the right place to be.

Also, is Xcode the compiler that most people use on mac? or is there others that work better

Your "Teach yourself C++" book will be just about learning the C++ language, and that will work best if you start in XCode with "New Project", then choose the "MacOS X / Applications / Command Line Tools" project, and then use Command-R to run it. Everything you learn there can be applied to any other computer (Linux, Windows, etc. ) using C++ as well.

Other templates like "Cocoa Application" would be what you eventually use to write applications, but you'll need a lot more knowledge to use them successfully, so that's not a good way to start.

And all the Apple software is created with XCode, so you are in good company there. The whole of MacOS X, and iOS, and all of Apple's own applications. Plus everything you can buy on the App Store for iOS or MacOS X.
 
the book is called "Sams Teach Yourself C++ in One Hour a Day" by Jesse Liberty, Siddhartha Rao, and Bradley Jones

It seems like a pretty informative book so far

Based on what? That book has no information at all on Xcode. So to learn anything about Xcode, your primary tool, you'll need another resource entirely. At the very least, find an Xcode 4 tutorial, or find another book that will teach you Xcode 4.

Also, why C++? If your goal is to write Mac programs, that's not the primary language; Objective-C is. And there's not nearly enough similarity between the two languages, that learning one will help you much when learning the other.
 
Based on what? That book has no information at all on Xcode. So to learn anything about Xcode, your primary tool, you'll need another resource entirely. At the very least, find an Xcode 4 tutorial, or find another book that will teach you Xcode 4.

Also, why C++? If your goal is to write Mac programs, that's not the primary language; Objective-C is. And there's not nearly enough similarity between the two languages, that learning one will help you much when learning the other.

The book is written in a way that anyone on any platform can learn from it. there aren't many books that I've seen that are about learning C++ in Xcode.

and by the way I'm not just trying to learn how to program mac programs, I'm trying to learn how to program in general, wether it be on a mac or pc. i picked C++ because it seems like a good place to start, after that i was going to learn Objective C and then lean some other languages if i like it
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.