PDA

View Full Version : C++ Compiler & XCode :: Something is going wrong




Saladsamurai
Sep 4, 2010, 06:44 PM
Actually, I do not know if it is the compiler or not. I opened Xcode 3.2 and started a new project using the C++ Command Line option. A template opens up with the generic "Hello World" program. But when I click "Build and Run" it won't execute. I get the following error:



Launch Stopped

The active architecture ppc is not supported by the debugger for cpu architecture i386/x86_64.


Here is the code that opens automatically:

#include <iostream>

int main (int argc, char * const argv[]) {
// insert code here...
std::cout << "Hello, World!\n";
return 0;
}


I also suck at programming related stuff and only do it when I am forced to. So please use small words when talking to me. :o :D

Also: I have XCode 3.2.2 and I think there is something more updated. Is there an easy way to just update XCode? I tried going to Apple's XCode site (http://developer.apple.com/technologies/tools/xcode.html) but I am not seeing an option to "update." Just a "download" which I presume is a "Full Download."



balamw
Sep 4, 2010, 08:58 PM
There should be a dropdown box at the top left of the Xcode Window. Right above Overview. Pull that down and see what the Active Architecture says. Should be either i386 or x86_64, NOT ppc.

B

Saladsamurai
Sep 4, 2010, 10:59 PM
There should be a dropdown box at the top left of the Xcode Window. Right above Overview. Pull that down and see what the Active Architecture says. Should be either i386 or x86_64, NOT ppc.

B

Ah ha. Thanks b! I have only ever used really generic IDEs like Blooshed's Dev C++. What exactly is that drop down menu for? Does it tell the compiler what kind of hardware I am working on or something?

Thanks!

PS I will be responding to the FORTRAN thread again tomorrow. I needed to take a break from it before I hurt myself! :D

mac2x
Sep 4, 2010, 11:53 PM
Ah ha. Thanks b! I have only ever used really generic IDEs like Blooshed's Dev C++. What exactly is that drop down menu for? Does it tell the compiler what kind of hardware I am working on or something?

Thanks!
[...]


You are telling the compiler whether you want to build in debug or release configuration, as well as the architecture. You can access a lot more settings by selecting your target on the left and clicking "info". For example, you can set it to only build the active architecture or you can build a universal binary with 2 or more architectures.

Saladsamurai
Sep 5, 2010, 01:46 PM
You are telling the compiler whether you want to build in debug or release configuration, as well as the architecture. You can access a lot more settings by selecting your target on the left and clicking "info". For example, you can set it to only build the active architecture or you can build a universal binary with 2 or more architectures.

I see. Kind of. Do you know of any good sources where I can read up on what the differences are? For example, I don't know what it means to be in "debug" or "release" configuration. Or even what you really mean by "architecture." I (very loosely) know what "architecture" means in that it describes a processor type. But I am not sure if a) this is the same word we are referring to here and b) if it is, exactly how it relates to the writing of coding process.

Thanks :)

lee1210
Sep 5, 2010, 02:14 PM
I don't know the best place to point you in terms of documentation of these things. I can't tell you where I learned about debug symbols, etc. specifically... probably around the first time someone showed me a debugger as an alternative to endless print statements in a program, and how to compile with debugging symbols. Basically a debug build is one that you, and perhaps a limited audience of testers, will use while you are developing the application. It builds your program in a way that makes it easier to track down problems. Some if this is the specific file and line number associated with a particular instruction. Generally this extra information is not needed or desired when deploying the application to an end user, so you will switch to a release build which will omit these extra symbols and information, resulting in a smaller and at times faster (if you use debugging macros, etc.) application.

As for architecture... I probably learned that in-depth in a university course. I may have known about it tangentially before that in regards to there being SPARC machines, PowerPC machines, etc. along with x86 machines, but I probably really didn't know the nuts and bolts until the course I took. There are about 4 architectures that I am aware of in-play in Apple's wheelhouse right now, PPC, ARM, x86, and x86_64. With all of these available, you have to be able to build binaries that target one or many of these. Apple allows for creation of "Universal Binaries" that contain the executable code for multiple architectures along with other resources in a single application package. This way a user doesn't need to be concerned with getting the right version for their machine. There's also Rosetta, a technology apple licensed to allow for fast(ish) execution of PPC code on Intel machines. What the message is telling you is that you have an x86 machine, and the debugger in-use in XCode is not capable of debugging PPC code on an x86 machine.

-Lee

chown33
Sep 5, 2010, 02:16 PM
What you should do is describe precisely what immediate goal you want to achieve. We may be able to provide step-by-step instructions for that specific goal.

Otherwise you seem to be asking for an impromptu yet thorough tutorial on all aspects of software development using Xcode, including such principles as CPU architecture and Xcode build configurations, as a series of questions provided by you and answers provided by others. That approach is completely impractical.


The Xcode reference guides will tell you about Xcode build configurations. They are accessible under Xcode's Help menu. If those are too complex, then you should at least start with the Xcode tutorial.
http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/A_Tour_of_Xcode/000-Introduction/qt_intro.html

You can find more links with these google search terms:
xcode tutorial site:developer.apple.com


If you intend to learn programming, there are any number of books that would work, although doing it in Fortran is going to be a significant limiting factor. If you don't intend to learn programming, then you should hire someone who can do it for you.