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

ChrisBrightwell

macrumors 68020
Original poster
Apr 5, 2004
2,294
0
Huntsville, AL
Hi everyone,

I'm not a programming n00b by any means, but my ability to troubleshoot CLI dev tools is relatively nil.

Here's my command and the subsequent error:

mario:~/Desktop chris$ g++ HelloWorld.cpp
ld: can't locate file for: -lcrt1.o

Any ideas? If I try it with the -c flag, it compiles but I can't do anything with it:

mario:~/Desktop chris$ gcc -c HelloWorld.cpp
mario:~/Desktop chris$ chmod +x HelloWorld.o
mario:~/Desktop chris$ ./HelloWorld.o
-bash: ./HelloWorld.o: Bad executable (or shared library)

I'm stumped.
 

widgetman

macrumors member
Oct 7, 2004
39
0
i dont know what that strange error is, but you can make an executable straight out of g++ using the "-o" (output) flag. like this:

g++ HelloWorld.cpp -o HelloWorld

that creates an executable called HelloWorld that when double-clicked, will open up and run in the terminal. or you can ./ it and it'll work. No chmodding neccessary! :)
 

ChrisBrightwell

macrumors 68020
Original poster
Apr 5, 2004
2,294
0
Huntsville, AL
Downloaded and installed Xcode 1.5 and it worked. The version on my CD (which came with Panther, obviously) was 1.0 and Software Update would only update it to 1.1.

Weird, but whatever. It works now. :)
 

Zion Grail

macrumors regular
Dec 24, 2002
104
0
Chicagoland
Really? It went away?

Thanks, that actually helps me. I had the same problem.

Of course, when I try to download Xcode 1.5, it gives me a 404 error. Just my freakin' unbelievable luck.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.