Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Compile errors

Compile errors
Thread Tools
Fresh-Faced Recruit
Join Date: Jan 2002
Status: Offline
Reply With Quote
Mar 14, 2002, 07:19 PM
 
I'm trying to compile some old C++ code I wrote for a programming course. When I say <BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier> cc program.cpp </font>[/code] I always get this error message:

<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier> /usr/bin/ld: Undefined symbols:
___ls__7ostreamPCc
___ls__7ostreamd
___rs__7istreamRd
_cin
_cout </font>[/code]

Clearly, it doesn't like my use of cin and cout. I have the December 2001 Developer Tools with the latest update. Does anyone know why this is happening? Thank you very much.
     
Grizzled Veteran
Join Date: Apr 2001
Status: Offline
Reply With Quote
Mar 14, 2002, 08:26 PM
 
Because you didn't include the proper library.

The easiest way to correct that is:

"c++ program.cpp"

Wade
     
Fresh-Faced Recruit
Join Date: Jan 2002
Status: Offline
Reply With Quote
Mar 14, 2002, 08:32 PM
 
All right. As long as I have your attention, I have another question. After executing the aboce command, I get an a.out file in my home folder. It's essentially gibberish. If it's all compiled, how do I execute the program? Thanks for humoring me.
     
Grizzled Veteran
Join Date: Apr 2001
Status: Offline
Reply With Quote
Mar 14, 2002, 08:36 PM
 
The current directory is not in your path. Do: "./a.out"

Wade
     
Mac Elite
Join Date: Sep 2000
Location: Tempe, AZ
Status: Offline
Reply With Quote
Mar 14, 2002, 08:37 PM
 
From the terminal, type ./a.out

This means, execute the program that has as its path "currentDirectory/a.out"
Geekspiff - generating spiffdiddlee software since before you began paying attention.
     
Fresh-Faced Recruit
Join Date: Jan 2002
Status: Offline
Reply With Quote
Mar 14, 2002, 08:38 PM
 
You just made my night. Seriously.

This is why I love the Mac community.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:52 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2