I am trying to write a C program that uses dlysm, and I keep getting an undefined deference to dlysm. I think I need to set my -ldl flags but I have no idea how to do this. I am very new to linux and setting variables. If this is what I need to do can someone help me out with the commands?
+1
A:
Pass -ldl as a param to the compiler.
Example:
gcc myprog.c -o app -ldl
Kknd
2008-11-11 01:30:57
+1
A:
-l library options are used at link time.
If you compile just one source file (gcc -o program program.c), then you both compile and link in one go. Just add the -ldl.
If you compile multiple object (*.o) files, and then link them together, specify the -ldl option to the linker (ld).
See also man ld and man cc
gnud
2008-11-11 01:31:44
I get this error user@ubuntu8041:~$ gcc -Wall -g -o mymalloc mymalloc.c -ldl/usr/lib/gcc/i486-linux-gnu/4.2.4/../../../../lib/crt1.o: In function `_start':(.text+0x18): undefined reference to `main'collect2: ld returned 1 exit status
2008-11-11 01:36:38
This says that you didn't define a main() function; the runtime library requires a main to run your program.
Ben Combee
2008-11-11 02:00:08