flex,bison 으로 컴파일시

익명 사용자의 이미지

flex,bison으로 C화일을 성성후 gcc로 컴파일 하면 다음과 같은 에러가 나
는데 어떻게 해야하지요
유닉스 환경에서는 -ll -ly 로 컴파일 하면 됐는데
gnu 환경에서는 -lfl 다음에 어떤 라이브러리를 링크 시켜야 할까요?
-ly는 안되더군요
/cygdrive/c/DOCUME~1/Vaio/LOCALS~1/Temp/ccCUkRWb.o
(.text+0x8bd)y.tab.c undefin
ed reference to `yyerror'
/cygdrive/c/DOCUME~1/Vaio/LOCALS~1/Temp/ccCUkRWb.o
(.text+0x9c5)y.tab.c undefin
ed reference to `yyerror'
collect2 ld returned 1 exit status

익명 사용자의 이미지

flex 를 컴파일 할때는 옵션이 -lfl 입니다.

그리고 bison 은 그냥 컴파일 하시면 됩니다. -_-;;;

옵션 필요없습니다.

그럼 고운 하루되시길...

ps. 기억이 가물가물해서 대충 적었는데, 틀리면... ^^ 죄송...

익명 사용자의 이미지

bison 컴파일시 아무 옵션도 지정하지 않으니까 역시 같은에러가 뜨던데..

저도 벌써 3일째 헤매이고 있습니다.

bison 컴파일시 gcc에서 어떤 library를 link시켜야 하죠?

어느 분은 멀 include 시켜서 해결하라고 하던데, 이것도 무슨 소리인지
도 모르겠고....

먼가 속 시원한 해결책이 없을까요?

익명 사용자의 이미지

bison화일은 그냥컴파일 하면되는데 이를 gcc로 lex와 같이 컴파일 하면
에러가 납니다...
계속 못찾고 있는데 아시는 분안계신가요?

익명 사용자의 이미지

님과 같은 문제로 3일동안 고민하다가 드뎌 쇼부봤습니다.
님도 windows상에서 cygwin 쓰고 계시죠?

이곳에는 liby.a 가 없어서 bison으로 만든 c파일을 컴파일하기가 쉽지 않
더군요..( flex는 libfl.a 가 있는데....)

약간 귀찮은 방법이긴 하지만 해결책을 알아내 올립니다.
방법은 yacc원본파알 (xxx.y)에 yyerror함수를 기술하는 것입니다.

우선 yacc의 맨위의 선언부에 stdio.h를 include합니다.
%{ #include %}
이런식으로 말이죠...
그리고 yacc의 3번째 부분, 즉 c함수를 기술하는 부분에 다음과 같이 넣습
니다.
%%
main()
{
yyparse();
}

yyerror(s)
char *s;
{
printf(stderr, "%s\n", s);
}

이런식으로 yyerror함수를 직접 기술해주면 library를 링크할 필요없이 컴
파일 작업이 가능하더군요.

컴파일러 공부하시는것 같은데, 혹시 하다가 더 좋은 방법있으면 알려주세
요~~~ ..^^;

익명 사용자의 이미지

..

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.