{"id":1582,"date":"2022-08-30T15:17:44","date_gmt":"2022-08-30T15:17:44","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/27\/undefined-references-when-trying-to-use-borland-headers-on-linux-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:17:44","modified_gmt":"2022-08-30T15:17:44","slug":"undefined-references-when-trying-to-use-borland-headers-on-linux-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/undefined-references-when-trying-to-use-borland-headers-on-linux-collection-of-common-programming-errors\/","title":{"rendered":"Undefined references when trying to use Borland headers on Linux-Collection of common programming errors"},"content":{"rendered":"<p>Compiler Error Output:<\/p>\n<pre><code>\"\/usr\/bin\/gmake\" -f nbproject\/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf\ngmake[1]: Entering directory `\/home\/josh\/Projects\/Maze\/Charon'\n\"\/usr\/bin\/gmake\"  -f nbproject\/Makefile-Debug.mk dist\/Debug\/GNU-Linux-x86\/charon\ngmake[2]: Entering directory `\/home\/josh\/Projects\/Maze\/Charon'\nmkdir -p build\/Debug\/GNU-Linux-x86\/sys\nrm -f build\/Debug\/GNU-Linux-x86\/sys\/charon.o.d\ng++    -c -g -MMD -MP -MF build\/Debug\/GNU-Linux-x86\/sys\/charon.o.d -o build\/Debug\/GNU-Linux-x86\/sys\/charon.o sys\/charon.cpp\nmkdir -p dist\/Debug\/GNU-Linux-x86\ng++     -o dist\/Debug\/GNU-Linux-x86\/charon build\/Debug\/GNU-Linux-x86\/sys\/charon.o build\/Debug\/GNU-Linux-x86\/main.o build\/Debug\/GNU-Linux-x86\/sys\/chin.o build\/Debug\/GNU-Linux-x86\/sys\/chout.o  \nbuild\/Debug\/GNU-Linux-x86\/sys\/chin.o: In function `chio::chin_::check()':\n<\/code><\/pre>\n<p>This right here is what I am struggling with. I painstakingly setup the library I use for these functions so I don&#8217;t know what I fubar&#8217;d<\/p>\n<pre><code>\/home\/josh\/Projects\/Maze\/Charon\/sys\/chin.cpp:28: undefined reference to `kbhit'\n\/home\/josh\/Projects\/Maze\/Charon\/sys\/chin.cpp:33: undefined reference to `stdscr'\n\/home\/josh\/Projects\/Maze\/Charon\/sys\/chin.cpp:33: undefined reference to `wgetch'\n\/home\/josh\/Projects\/Maze\/Charon\/sys\/chin.cpp:35: undefined reference to `kbhit'\ncollect2: ld returned 1 exit status\ngmake[2]: *** [dist\/Debug\/GNU-Linux-x86\/charon] Error 1\ngmake[2]: Leaving directory `\/home\/josh\/Projects\/Maze\/Charon'\ngmake[1]: *** [.build-conf] Error 2\ngmake[1]: Leaving directory `\/home\/josh\/Projects\/Maze\/Charon'\ngmake: *** [.build-impl] Error 2\n\n\nBUILD FAILED (exit value 2, total time: 1s)\n<\/code><\/pre>\n<p>Here is the cpp file chin.cpp<\/p>\n<pre><code>\/* \n * File:   chin.cpp\n * Author: josh\n * \n * Created on 08 April 2012, 10:00\n *\/\n#include \n#include \n#include \n#include \n#include \"..\/headers\/charon.h\"\n\nusing namespace std;\nusing namespace charon;\nusing namespace chio;\nnamespace chio\n{\n  chin_::chin_(){}\n  chin_::chin_(charon_ &amp;handle) {\n    engine = &amp;handle;\n    \/\/key_presses = new deque();\n  }\n  chin_::~chin_() {\n  }\n\n  bool chin_::check()\n  {\n    if(kbhit())\n    {\n      while(true)\n      {\n        char ch;\n        ch = getch();\n        key_presses.push_back(ch);\n        if(!kbhit())\n          return true;\n      }\n    }\n    return false;\n  }\n\n  void chin_::update()\n  {\n    while(stream_in)\n    {\n      check();\n    }\n  }\n}\n<\/code><\/pre>\n<p>So at the top of that file you can see that I include borland\/conio.h When I was searching for a particular function I used all the time back in the day I found it was in conio.h which has something to do with borland, a compiler if I remember correctly. I had to install dev-c++ bloodshed on windows, grab the include directory I then renamed it to borland and popped it into my linux box&#8217;s include directory.<\/p>\n<p>I had one compile error originally about a dependency within a header, either conio itself or one it used, and all I did was change it so that it pointed to the correct place.<\/p>\n<p>Now I don&#8217;t know what the heck is going on because I expected the compiler to simply find all of those. It finds the header file so the only thing I can think of is maybe the header isn&#8217;t able to find hpp files, but then why isn&#8217;t it saying that instead of specifying the functions within said hypothetical hpp files. So since I am into hypothetical situations here, I clearly need some help.<\/p>\n<ol>\n<li>\n<p>You have two problems.<\/p>\n<ol>\n<li>\n<p>You can&#8217;t just take the Borland headers and just drop them in and expect them to work. Headers are usually dependent on libraries. These are platform-specific (and sometimes compiler-specific), which won&#8217;t work when used on a different OS. Not to mention, the headers often include a bunch of other headers, which include other headers, etc. Some or all of these may be compiler or platform specific.<\/p>\n<\/li>\n<li>\n<p>CONIO.H was a nonstandard Windows-only header and is not used any more. There is probably another, correct way to do this.<\/p>\n<\/li>\n<\/ol>\n<\/li>\n<li>\n<p>You have a linker error because it is not linking against the library that contains the implementation for those functions. You use -l to specify libraries to link with, and LIBRARY_PATH specifies path to find libraries<\/p>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2013-11-27 11:53:36. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>Compiler Error Output: &#8220;\/usr\/bin\/gmake&#8221; -f nbproject\/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf gmake[1]: Entering directory `\/home\/josh\/Projects\/Maze\/Charon&#8217; &#8220;\/usr\/bin\/gmake&#8221; -f nbproject\/Makefile-Debug.mk dist\/Debug\/GNU-Linux-x86\/charon gmake[2]: Entering directory `\/home\/josh\/Projects\/Maze\/Charon&#8217; mkdir -p build\/Debug\/GNU-Linux-x86\/sys rm -f build\/Debug\/GNU-Linux-x86\/sys\/charon.o.d g++ -c -g -MMD -MP -MF build\/Debug\/GNU-Linux-x86\/sys\/charon.o.d -o build\/Debug\/GNU-Linux-x86\/sys\/charon.o sys\/charon.cpp mkdir -p dist\/Debug\/GNU-Linux-x86 g++ -o dist\/Debug\/GNU-Linux-x86\/charon build\/Debug\/GNU-Linux-x86\/sys\/charon.o build\/Debug\/GNU-Linux-x86\/main.o build\/Debug\/GNU-Linux-x86\/sys\/chin.o build\/Debug\/GNU-Linux-x86\/sys\/chout.o build\/Debug\/GNU-Linux-x86\/sys\/chin.o: In function `chio::chin_::check()&#8217;: This right here is [&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-1582","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1582","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=1582"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1582\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1582"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1582"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1582"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}