View Full Version : Starting with C++, getting non-existant error message

Zion Grail
Jan 25, 2005, 12:18 AM
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?

Jan 25, 2005, 01:56 AM
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

Jan 28, 2005, 07:22 PM
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
Jan 28, 2005, 09:34 PM
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
Jan 30, 2005, 09:25 PM
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.

Jan 31, 2005, 03:14 AM
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. :)