I compiled with gcc
gcc -l. 'net-snmp-config --cflags' -fPlC -shared -c -o matsu_object.o tsu_object.c
but this error occurred
gcc: -lcrypto: Because a link was not completed, the input file of the linker was not used
What's wrong?
I compiled with gcc
gcc -l. 'net-snmp-config --cflags' -fPlC -shared -c -o matsu_object.o tsu_object.c
but this error occurred
gcc: -lcrypto: Because a link was not completed, the input file of the linker was not used
What's wrong?
I think you are using ticks ' instead of back ticks `. Does --cflags really give linker options? I think you are at the link step here. Also what is the effect of -c at a link. I thought -c was compile only and not attempt to link.
Did you mistype the question? There's no way for that to output the message you write, and I would expect that the proper command is something more like
gcc -L. `net-snmp-config --cflags` -fPIC -shared -c -o matsu_object.o tsu_object.c
Notice the -L
uppercase, backticks instead of single quotes, and upper-case I
in PIC
.
Also, you don't say what you're trying to do, but net-snmp-config
should also take at least one of --libs
or --agent-libs
as well.
Ah, I didn't read closely enough...
-c
means "compile", that is: generate from tsu_object.c
, a compiled matsu_object.o
.
Without -c
, the compiler actually links, that is: generate from *.o
, a.out
or other specified file.
-shared
(and linker flags like -l
and -L
) are only meaningful when linking. They're meaningless when compiling, as you are doing here because of -c
.
Please correct the command-line in the question to accurately reflect what you're running, and give some more explanation as to what you're trying to do.
You used single quotes instead of backquotes.
Instead of this:
gcc -l. 'net-snmp-config --cflags' -fPlC -shared -c -o matsu_object.o tsu_object.c
You should type:
gcc -l. `net-snmp-config --cflags`-fPlC -shared -c -o matsu_object.o tsu_object.c
net-snmp-config is a program. When you run it with --cflags, it evaluates to the correct cflags that you should be using to compile your program.
But you know what? You should be using autoconf. Even for something this small, it usually makes sense to do the work. Most people I know need to compile on more than one platform...