If I want to use graphics.h or conio.h with C, how do I even install it and get it to work?
Asked
Active
Viewed 105 times
-1
-
Every C library should have a `README` or other included documentation (also check `man`) with instructions on how to use it, either as source, or a static or dynamic link target. – Dai Mar 05 '22 at 22:57
-
3Also, we have absolutely no idea which library you're referring to when you say "`graphics.h`" - so please tell us what you're trying to do and where you're getting these libraries from. – Dai Mar 05 '22 at 22:57
-
1packages ending in `-dev` contain the headers and libs required for development – Diego Torres Milano Mar 05 '22 at 22:58
-
[`conio.h` is for targeting MS-DOS... not Ubuntu](https://stackoverflow.com/questions/8792317/where-is-the-conio-h-header-file-on-linux-why-cant-i-find-conio-h). – Dai Mar 05 '22 at 22:58
-
oh well i watched a tutorial on youtube on how to use conio a few moments ago and it still works fine on ubuntus terminal. also idk what you mean i thought that graphics.h was something everyone knows about, like a popular python library – Mr_Arsonist Mar 05 '22 at 23:02
-
but also i dont even know where to get certain packages, do i get them from github or what – Mr_Arsonist Mar 05 '22 at 23:02
-
@Mr_Arsonist "Packages" and package-repositories really aren't a thing for C or C++ - or really any programming language that was created before the early-2000s. The idea of publicly-available reusable libs made available under permissive licenses (like BSD, MIT, and Apache) and hosted _at great expense_ by tooling vendors (like NuGet, npm, Pypi, etc) is a very, very recent thing. Before the 2000s I think most software companies treated their libraries as either proprietary trade secrets kept under lock-and-key, or charged $$$ for them. At least C++ has Boost, though, which is nice. – Dai Mar 06 '22 at 03:19
-
i didnt know, thank you. i suppose you are supposed to code everything yourself? – Mr_Arsonist Mar 08 '22 at 22:42
1 Answers
0
You must have an archive of the respectively library that you want in your directory for libraries.
Then you will just import them typing, for example (the most common library in C):
#include <stdio.h>
So, do the following
- Add library archive to the libraries directory
- import them typing
#include
<name-of-the-library .h>

Rodrigo
- 61
- 1
- 12
-
ohh okay! thats what stdlib is for i was confused about that. but where do you actually install libraries that you want to use? – Mr_Arsonist Mar 05 '22 at 23:08
-
yeah, you can install a library downloading the library and then moving it to the directory containing the libraries – Rodrigo Mar 05 '22 at 23:10
-
do you get it from github? im using WSL right now, if i wanted to install graphics.h or something, how would i do it? – Mr_Arsonist Mar 05 '22 at 23:12
-
In that case I would type `explorer.exe .` in the wsl command line to search the libraries directory and then move the desired library into it – Rodrigo Mar 05 '22 at 23:24