Reputation: 29
This is my makefile:
cpp2html: cpp2html.o lex.yy.o
gcc -c cpp2html.o lex.yy.o
cpp2html.o: cpp2html.c
gcc -c cpp2html.c
lex.yy.c: cppscanner.l
flex cppscanner.l
lex.yy.o: lex.yy.c
gcc -c lex.yy.c
When I try to run it I get this error:
gcc -c cpp2html.o lex.yy.o
gcc: warning: cpp2html.o: linker input file unused because linking not done
gcc: warning: lex.yy.o: linker input file unused because linking not done
I am very new to Unix so any help is greatly appreciated
Upvotes: 0
Views: 191
Reputation: 100781
The -c
option to the compiler tells it to compile only and generate a .o
file. When you're linking a program you do not want to use -c
.
Since you say you're new to UNIX I'll mention that UNIX has a long history of including documentation with the system; there are reference pages called man pages that can be read using the man
command. You can, at the command line, run man gcc
(or man ls
or whatever) to get a synopsis of how to use a program along with (at least) it's most basic options and what they do. This is not in-depth documentation but it's handy. For a complex program like the compiler there is often other additional documentation available; the man page will usually tell you how to access it.
And, for GCC and other similar tools, there is online documentation as well.
Upvotes: 2