Hi All
I'm trying to build a shared object (dylib), but when compiling I get the following:
Code:
$ make
gcc -fPIC -c libmyconfig.c -o libmyconfig.o
gcc -Wall -g -fast -dynamiclib -current_version 1.0 -o libmyconfig.dylib libmyconfig.o
Undefined symbols:
"_strpos", referenced from:
_load_config_file in libmyconfig.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [libmyconfig.dylib] Error 1
It has everything todo with the strpos:
Code:
#include <stddef.h>
#include <stdlib.h>
#include <regex.h>
#include <stdio.h>
#include <string.h>
....
...
char line [ 128 ]; /* or other suitable maximum line size */
...
while(fgets(line, sizeof(line), fp) != NULL)
{
int pos = strpos(line, '=') ;
if I remove the last line, everything compiles fine. Furthermore, on Linux I don't have any problems
Code:
$ make linux
gcc -fPIC -c libmyconfig.c -o libmyconfig.o
gcc -shared -o libmyconfig.so.1.0 -lc libmyconfig.o
ldconfig -v -n .
.:
libmyconfig.so.1.0 -> libmyconfig.so.1.0
ln -sf libmyconfig.so.1.0 libmyconfig.so
Library libmyconfig.so created
Any suggestions what might be the problem on my mac (osx 10.5, i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5465) ?
thnx
LuCa
ps if more info is needed please let me know, because this problem really stopped me