Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Apr 23, 2005, 03:25 PM   #1
pigbrain
macrumors newbie
 
Join Date: Mar 2005
gcc compilation error -- ld: Undefined symbols

I use a dictionary program on SunOS and planned to port it onto my Mac. I tried to compile it but got the error message:

Quote:
ld: Undefined symbols:
_re_comp
_re_exec
I know the functions "re_comp" and "re_exec" are used for regular expression and I have imported unistd.h in the header file:
Code:
    ......
    #include <unistd.h>
    #ifdef __svr4__
    #include <libgen.h>
    #else
    extern char *re_comp(char *);
    extern int   re_exec(char *);
    #endif
    ......
I've even tried to take off the if-else condition. Anyhow the code compiles on SunOS but not on Mac. Is that because these two functions are deprecated or not provided on Mac?

Any suggestion? Thanks a ton.
pigbrain is offline   0 Reply With Quote
Old Apr 23, 2005, 03:35 PM   #2
MacNeXT
macrumors 6502
 
Join Date: Jun 2004
ld is the linker. The linker misses a binary in which those symbols have to be found.
__________________
Oh, and by the way, Micro$oft suxorz!!!
MacNeXT is offline   0 Reply With Quote
Old Apr 23, 2005, 03:47 PM   #3
daveL
macrumors 68020
 
daveL's Avatar
 
Join Date: Jun 2003
Location: Montana
You need to link in libcompat, which doesn't seem to be included in OS X, or you have to change the code the code to use the newer 'regex' functions, which are in libc. You can get libcompat from the Darwin "ports" project (dport).
__________________
-daveL
daveL is offline   0 Reply With Quote
Old Apr 26, 2005, 05:45 PM   #4
pigbrain
Thread Starter
macrumors newbie
 
Join Date: Mar 2005
I use regex functions and it compiles now. Thanks a ton.
pigbrain is offline   0 Reply With Quote
Old Apr 26, 2005, 06:32 PM   #5
daveL
macrumors 68020
 
daveL's Avatar
 
Join Date: Jun 2003
Location: Montana
Quote:
Originally Posted by pigbrain
I use regex functions and it compiles now. Thanks a ton.
My pleasure.
__________________
-daveL
daveL is offline   0 Reply With Quote
Old Jul 19, 2005, 05:59 AM   #6
gabitruc
macrumors newbie
 
Join Date: Jul 2005
ld: Undefined symbols:

Hello!

I'm having a similar problem, and cannot find which library I have to link. Does anyone have an idea?

The error is :

Code:
ld: Undefined symbols:
_CFDataGetBytes
_CFRelease
_CFShow
___CFStringMakeConstantString
_kCFAllocatorDefault
/usr/bin/libtool: internal link edit command failed
I don't know where to find those functions.
Oddly, when I compile with XCode, it works fine. XCode must include automatically the missing libraries, I think.

Does anyone know where those functions come from ?
gabitruc is offline   0 Reply With Quote
Old Jul 19, 2005, 07:23 AM   #7
gabitruc
macrumors newbie
 
Join Date: Jul 2005
Quote:
Originally Posted by gabitruc
Does anyone know where those functions come from ?
Ok, I found it. -framework CoreFoundation solved the problem.
gabitruc is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting 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

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
GCC complaining about undefined symbols when trying to compile .o for using as JNI. ColdStone Mac Programming 1 Jul 24, 2011 12:33 PM
compiling error -f68881 higeorge Mac Programming 2 Nov 16, 2010 01:31 PM
GCC complaining about undefined symbols when trying to compile for 10.5 in 10.6 foidulus Mac Programming 2 May 4, 2010 01:07 PM
/usr/bin/ld: Undefined symbols: kipepeo Mac Programming 3 May 25, 2007 04:30 AM
ld: Undefined symbols:_main rain Mac Programming 1 Oct 23, 2004 06:59 PM


All times are GMT -5. The time now is 02:13 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

Privacy / DMCA contact / Affiliate and FTC Disclosure
Copyright 2002-2013, MacRumors.com, LLC