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

Zion Grail

macrumors regular
Original poster
Dec 24, 2002
104
0
Chicagoland
OK, I've gotten through one semester of Computer Science here at my new universiy. The first semester, we worked with Java. I did pretty good with it, but now we've moving on to C++.

I'm putting in the sample program, and I hit "Build" in Xcode and... it fails. It compiles, but doesn't build. I get one error message.

Unfortunately, it doesn't tell me what the message is. Seriously. It says the build failed with one error, I double-click on the error symbol, and it opens the error message window and it has nothing in it.

This is getting frustrating. Anyone have any thoughts?
 

therevolution

macrumors 6502
May 12, 2003
468
0
Have you tried opening a Terminal window and using gcc? Type:

g++ <yourfile>

If you get no errors, your program is created and called "a.out". If you still get an error, maybe it will be more helpful. I don't know how to compile in Xcode... I'm all about the command line. :D
 

fintler

macrumors newbie
Aug 5, 2003
13
0
When you make your project in Xcode select "C++ Tool" under "Command Line Utility" in the assistant. Then when the project is created it'll start you off with a file that already has the required linked libstdc++ and a main.cpp file with your int main(). When you run the program it'll put up a window with the cout, clog, cerr, etc text.
 

Zion Grail

macrumors regular
Original poster
Dec 24, 2002
104
0
Chicagoland
Actually...

That's exactly what I did, and I'm getting that strange "error but no error" result. (Note: Until Apple fixes the download link on their website, I'm stuck with Xcode 1.1.)

Using g++ gives me this error:

ld: can't locate file for: -lcrt1.o
 

Zion Grail

macrumors regular
Original poster
Dec 24, 2002
104
0
Chicagoland
The Solution!

For all those who are having trouble with this same thing, do this.

Go to /Applications/Installers/Xcode Tools/Packages/

Run "DevSDK.pkg"

The problem goes away.

If DevSDK.pkg isn't there, re-install the Xcode Tools from the Xcode Tools CD.
 

northen

macrumors member
Jan 8, 2005
80
0
Aalborg, Denmark
C++ can be pretty problematic at times (the support is very poor compared to that of C and Obj-C). Try getting the G++ compiler patch from ADC, and if you fail, try reinstalling the XCode utilities. :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.