Re: [SLE] Install source
- From: stephan beal <stephan@xxxxxxxx>
- Date: Sat, 2 Sep 2006 05:23:33 +0200
On Saturday 02 September 2006 05:06, Harshal Shah wrote:
when i work with lex & yacc on novelsuse 10 ent. i found that i can
compile lexspecification file.l completely. It generates lee.yy.c .
In other linux we are able to compile lex.yy.c with command
"$ cc lex.yy.c -ll " then we see output "./a.out" . but in novelsuse
10 this command ("$ cc lex.yy.c -ll ") is not working & showing error
with collect2 id and not having "-ll" option.
We'll need the whole compilation/link error to know for sure. Try
compiling without -ll, as that library contains only a stub main()
routine which calls the lexer (if i recall correctly).
Something to try:
cc -o foo.o lex.yy.c
If that works, the code compiles. Then try:
cc -o foo foo.o
If that fails, it's probably because your program doesn't have a main()
routine. If that happens, you can try adding the following code to a
separate file (main.c, taken from the flex info pages):
#include <stdio.h>
main( int argc, char ** argv )
{
++argv, --argc; /* skip over program name */
if ( argc > 0 )
yyin = fopen( argv[0], "r" );
else
yyin = stdin;
yylex();
}
compile that with:
cc -o main.o main.c
And link it to your flexer with:
cc -o test main.o foo.o
If that works, the problem is simply that you don't need -ll but you
need to provide a main() routine to the flex-generated code.
suggest me what to do. how can i compile this in NovelSuse 10.
If you can send me the lex file off-list i can try it out on my 10.1
box. The problem may be related to differing flex versions on different
environments. Distros are starting to ship versions of flex newer than
2.5.4, and not all of those releases actually generate compilable code.
i believe that a collect2 error is a link error, though.
--
----- stephan@xxxxxxxx http://s11n.net
"...pleasure is a grace and is not obedient to the commands
of the will." -- Alan W. Watts
Attachment:
pgpNvGm88tbXV.pgp
Description: PGP signature
- Follow-Ups:
- Re: [SLE] Install source
- From: stephan beal
- Re: [SLE] Install source
- References:
- Re: [SLE] Install source
- From: Harshal Shah
- Re: [SLE] Install source
- Prev by Date: Re: [SLE] Install source
- Next by Date: Re: [SLE] Install source
- Previous by thread: Re: [SLE] Install source
- Next by thread: Re: [SLE] Install source
- Index(es):
Relevant Pages
|