shadow010397
asked on
when compiling on NextStep i get _putenv
When i try to compile a certain program with:
"cc -posix -o program program.c"
i get:
"ld: Undefined symbols:
_putenv"
And then it exits, and the program is supposed be in Posix standards, so i know it's not the Posix cmd., if i don't use it i get garble, so, it must be something else.
Is there any options cmds. i can use for this problem ?
"cc -posix -o program program.c"
i get:
"ld: Undefined symbols:
_putenv"
And then it exits, and the program is supposed be in Posix standards, so i know it's not the Posix cmd., if i don't use it i get garble, so, it must be something else.
Is there any options cmds. i can use for this problem ?
Even though it is part of the posix standard, you may still need to tell the compiler what libraries to link in. Check with your compiler's documentation to find out which library contains the code for putenv and add it to your compiler line.
ASKER
I have compiled on Linux & Windows and got no error. So , i don't know if it is a library, or the way the compiler takes the data.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
when i did that cmd. i got :
ld: multiple definitions of symbol __mach_data_padding
/usr/lib/libc.a(mach_data. o) definition of __mach_data_padding in section (__DATA,__data)
/usr/lib/libposix.a(mach_d ata.o) definition of __mach_data_padding in section (__DATA,__data)
ld: multiple definitions of symbol __old_mach_init_ports
/usr/lib/libc.a(mach_data. o) definition of __old_mach_init_ports in section (__DATA,__data)
/usr/lib/libposix.a(mach_d ata.o) definition of __old_mach_init_ports in section (__DATA,__data)
ld: multiple definitions of symbol __old_mach_init_ports_coun t
/usr/lib/libc.a(mach_data. o) definition of __old_mach_init_ports_coun t in section (__DATA,__data)
/usr/lib/libposix.a(mach_d ata.o) definition of __old_mach_init_ports_coun t in section (__DATA,__data)
ld: multiple definitions of symbol __event_port_by_tag
/usr/lib/libc.a(mach_traps .o) definition of __event_port_by_tag in section (__TEXT,__text)
/usr/lib/libposix.a(mach_t raps.o) definition of __event_port_by_tag in section (__TEXT,__text)
ld: multiple definitions of symbol __lookupd_port
/usr/lib/libc.a(mach_traps .o) definition of __lookupd_port in section (__TEXT,__text)
/usr/lib/libposix.a(mach_t raps.o) definition of __lookupd_port in section (__TEXT,__text)
ld: multiple definitions of symbol __cthread_fork_child
/usr/lib/libc.a(cthreads.o ) definition of __cthread_fork_child in section (__TEXT,__text)
/usr/lib/libposix.a(cthrea ds.o) definition of __cthread_fork_child in section (__TEXT,__text)
ld: multiple definitions of symbol __cthread_fork_parent
/usr/lib/libc.a(cthreads.o ) definition of __cthread_fork_parent in section (__TEXT,__text)
/usr/lib/libposix.a(cthrea ds.o) definition of __cthread_fork_parent in section (__TEXT,__text)
ld: multiple definitions of symbol __cthread_fork_prepare
/usr/lib/libc.a(cthreads.o ) definition of __cthread_fork_prepare in section (__TEXT,__text)
/usr/lib/libposix.a(cthrea ds.o) definition of __cthread_fork_prepare in section (__TEXT,__text)
ld: multiple definitions of symbol __set_cthread_free_callout
/usr/lib/libc.a(cthreads.o ) definition of __set_cthread_free_callout in section (__TEXT,__text)
/usr/lib/libposix.a(cthrea ds.o) definition of __set_cthread_free_callout in section (__TEXT,__text)
ld: multiple definitions of symbol __cproc_fork_child
/usr/lib/libc.a(cprocs.o) definition of __cproc_fork_child in section (__TEXT,__text)
/usr/lib/libposix.a(cprocs .o) definition of __cproc_fork_child in section (__TEXT,__text)
ld: multiple definitions of symbol __cthread_exit_routine
/usr/lib/libc.a(threads_da ta.o) definition of __cthread_exit_routine in section (__DATA,__data)
/usr/lib/libposix.a(thread s_data.o) definition of __cthread_exit_routine in section (__DATA,__data)
ld: multiple definitions of symbol __cthread_init_routine
/usr/lib/libc.a(threads_da ta.o) definition of __cthread_init_routine in section (__DATA,__data)
/usr/lib/libposix.a(thread s_data.o) definition of __cthread_init_routine in section (__DATA,__data)
ld: multiple definitions of symbol __threads_data_padding
/usr/lib/libc.a(threads_da ta.o) definition of __threads_data_padding in section (__DATA,__data)
/usr/lib/libposix.a(thread s_data.o) definition of __threads_data_padding in section (__DATA,__data)
ld: multiple definitions of symbol __dealloc_stack
/usr/lib/libc.a(stack.o) definition of __dealloc_stack in section (__TEXT,__text)
/usr/lib/libposix.a(stack. o) definition of __dealloc_stack in section (__TEXT,__text)
ld: multiple definitions of symbol __stack_fork_child
/usr/lib/libc.a(stack.o) definition of __stack_fork_child in section (__TEXT,__text)
/usr/lib/libposix.a(stack. o) definition of __stack_fork_child in section (__TEXT,__text)
ld: multiple definitions of symbol __mach_data_padding
/usr/lib/libc.a(mach_data.
/usr/lib/libposix.a(mach_d
ld: multiple definitions of symbol __old_mach_init_ports
/usr/lib/libc.a(mach_data.
/usr/lib/libposix.a(mach_d
ld: multiple definitions of symbol __old_mach_init_ports_coun
/usr/lib/libc.a(mach_data.
/usr/lib/libposix.a(mach_d
ld: multiple definitions of symbol __event_port_by_tag
/usr/lib/libc.a(mach_traps
/usr/lib/libposix.a(mach_t
ld: multiple definitions of symbol __lookupd_port
/usr/lib/libc.a(mach_traps
/usr/lib/libposix.a(mach_t
ld: multiple definitions of symbol __cthread_fork_child
/usr/lib/libc.a(cthreads.o
/usr/lib/libposix.a(cthrea
ld: multiple definitions of symbol __cthread_fork_parent
/usr/lib/libc.a(cthreads.o
/usr/lib/libposix.a(cthrea
ld: multiple definitions of symbol __cthread_fork_prepare
/usr/lib/libc.a(cthreads.o
/usr/lib/libposix.a(cthrea
ld: multiple definitions of symbol __set_cthread_free_callout
/usr/lib/libc.a(cthreads.o
/usr/lib/libposix.a(cthrea
ld: multiple definitions of symbol __cproc_fork_child
/usr/lib/libc.a(cprocs.o) definition of __cproc_fork_child in section (__TEXT,__text)
/usr/lib/libposix.a(cprocs
ld: multiple definitions of symbol __cthread_exit_routine
/usr/lib/libc.a(threads_da
/usr/lib/libposix.a(thread
ld: multiple definitions of symbol __cthread_init_routine
/usr/lib/libc.a(threads_da
/usr/lib/libposix.a(thread
ld: multiple definitions of symbol __threads_data_padding
/usr/lib/libc.a(threads_da
/usr/lib/libposix.a(thread
ld: multiple definitions of symbol __dealloc_stack
/usr/lib/libc.a(stack.o) definition of __dealloc_stack in section (__TEXT,__text)
/usr/lib/libposix.a(stack.
ld: multiple definitions of symbol __stack_fork_child
/usr/lib/libc.a(stack.o) definition of __stack_fork_child in section (__TEXT,__text)
/usr/lib/libposix.a(stack.