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 > Undefined Symbols?

Undefined Symbols?
Thread Tools
Grizzled Veteran
Join Date: Jun 2001
Status: Offline
Reply With Quote
Jun 22, 2003, 10:55 PM
 
I'm porting a Windows app to Mac, and it uses winpcap. I found that libpcap is a decent equivalent, and downloaded it. I did ./configure, make, and make install with no problem. 'man pcap' informs me that I need to #include <pcap.h>. I did that (and pcap.h IS in /usr/include), and used 2 different short pieces of sample code online to test it. I try to compile it, and I get a linking error about some undefined symbols. This image explains it all.

I asked another Mac developer I know, and he said I might need a pcap.o file in my project, which would normally be in /usr/lib (but it's not). The only pcap.o file that I found was in the directory I built libpcap in. Adding it to the project adds even more complaining about undefined symbols. I took pcap.o out of my project. What's up with it?
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Jun 23, 2003, 04:21 AM
 
That means you aren't linking libpcap into your program. Add the library to your project and you should be good to go.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
Grizzled Veteran
Join Date: Jun 2001
Status: Offline
Reply With Quote
Jun 23, 2003, 09:48 AM
 
Yeah, that's exacty what I want to do... How?
     
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status: Offline
Reply With Quote
Jun 23, 2003, 11:30 AM
 
Originally posted by macgyvr64:
Yeah, that's exacty what I want to do... How?
add -L/usr/lib -lpcap in on your compile line.
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
     
Grizzled Veteran
Join Date: Jun 2001
Status: Offline
Reply With Quote
Jun 25, 2003, 12:41 AM
 
When I do that, it can't find pcap.o. I think it should be in /usr/lib, but isn't...maybe I'll remake it.. hmmm. Any ideas?
     
Grizzled Veteran
Join Date: Apr 2001
Status: Offline
Reply With Quote
Jun 25, 2003, 03:31 PM
 
It probably put it in /usr/local/lib.

Wade
     
Grizzled Veteran
Join Date: Jun 2001
Status: Offline
Reply With Quote
Jun 25, 2003, 10:14 PM
 
hmmm...The only things in my /usr/local/lib are:

libexpat.0.4.0.dylib
libexpat.dylib
php
libexpat.0.dylib
libexpat.la
php.ini-copy
libexpat.a
libpcap.a
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Jun 25, 2003, 11:32 PM
 
Originally posted by macgyvr64:
hmmm...The only things in my /usr/local/lib are:

libexpat.0.4.0.dylib
libexpat.dylib
php
libexpat.0.dylib
libexpat.la
php.ini-copy
libexpat.a
libpcap.a
There it is, right at the bottom. You need to link to that.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
   
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 03:44 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