{"id":784,"date":"2022-08-30T15:07:07","date_gmt":"2022-08-30T15:07:07","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/undefined-symbols-for-architecture-x86_64-when-compiling-lex-and-yacc-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:07:07","modified_gmt":"2022-08-30T15:07:07","slug":"undefined-symbols-for-architecture-x86_64-when-compiling-lex-and-yacc-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/undefined-symbols-for-architecture-x86_64-when-compiling-lex-and-yacc-collection-of-common-programming-errors\/","title":{"rendered":"&ldquo;Undefined symbols for architecture x86_64:&rdquo; when compiling lex and yacc-Collection of common programming errors"},"content":{"rendered":"<p>Lex and Yacc work, but when I try to compile the y.tab.c file, I&#8217;m getting the following error. I have a feeling its a linking issue where compiler can&#8217;t find the library that it needs, but I have no idea how to fix it.<\/p>\n<p>In my nor.y file, I have this at the top:<\/p>\n<pre><code>%{\n#include \n%}\n<\/code><\/pre>\n<p>In my nor.l file, I have this at the top:<\/p>\n<pre><code> %{\n#include \"y.tab.h\"\n#include \nextern YYSTYPE yylval;\n%}\n<\/code><\/pre>\n<p>Then, when I try to compile with<\/p>\n<pre><code>gcc y.tab.h -ly -ll\n<\/code><\/pre>\n<p>I get the error:<\/p>\n<pre><code>Undefined symbols for architecture x86_64:\n  \"_yyparse\", referenced from:\n  _main in liby.a(main.o)\nld: symbol(s) not found for architecture x86_64\ncollect2: ld returned 1 exit status\n<\/code><\/pre>\n<p id=\"rop\"><small>Originally posted 2013-11-09 22:44:25. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>Lex and Yacc work, but when I try to compile the y.tab.c file, I&#8217;m getting the following error. I have a feeling its a linking issue where compiler can&#8217;t find the library that it needs, but I have no idea how to fix it. In my nor.y file, I have this at the top: %{ [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-784","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/784","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=784"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/784\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=784"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=784"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=784"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}