I want to use a library for making some shapes in my C program. Can I use gl.h in my C program if I install it? Will it be compatible or is it designed for languages other than C?
You normally dont install gl.h. It is just the header to a library. The library-implementation should already be provided by your OS/drivers eg in some .DLL-files. The header gl.h can just be #include'ed so you can call the functions.
You did not tell us your OS, but there are tutorials for each, eg for windows: have a look at the tutorials on the right side of http://nehe.gamedev.net/
Related
I am interested in creating a terminal-based text interface in C without the use of a library like ncurses. I know that through using tput and a variety of escape codes, it is possible to create such an interface. However, I am uncertain of how to use tput or similar commands in C.
First, I am wondering what the best option is for implementing something like this in C without external libraries (so it can be compiled and run on a bare bone system).
Second, if using tput is the best option, how can I call these commands from C?
I understand that using a pre-existing library, such as ncurses would greatly simplify the process, but I would like to create my program without them.
Thank you in advance.
The standard C library does not provide any functions that can be used instead of the functions in ncurses. You'll have to use ncurses or another third party library that provides the equivalent functionality.
Since this is my first question after years of finding answers in this site, id like to say a big thanks to everyone.
I want to use FANN in an embedded platform, and i am using UVision 4 to code in C.
Since i am a C/C++ rookie, i cant figure out if i can / how i can use that library.
When i try to simply include the files, i get this error:
FANN\fann.h(51): error: #5: cannot open source input file "sys/time.h": No such file or directory
which makes sense because i am not compiling for windows platform.
Can i use the FANN library for embedded C? If so, how to include it?
Thanks
You have to write your own "sys/time.h" for your embedded system. It must offer everything the original one does to be compatible with your external library. Wether you write one from scratch or wrap something around an existing code base which is compatible to your embedded device is up to you.
You can also have a look at this SO question.
If you're not compiling on windows you'll have no problem - simply include sys/time.h like this :
#include <sys/time.h>
Note the < and > character, these will make sure that your header is looked up within $PATH.
If your compiler still wont find that header you will need to install libc, on debian this can be done with tools like apt-get
Am using a Dev c++ compiler, to compile a c code. (I am a beginner)
When I compile, it says 'some' header files are missing.
How can i include those header files in my system, so as to be utilized by the program??
Thanks
A header such as <sys/sem.h> which is used for the function semget() among other things, is not generally available in Windows. It's a POSIX header, and Windows does not implement the POSIX standard out of the box.
You should maybe look at the Win32 API instead, for instance a function like CreateSemaphore().
The problem is that you are trying to use the Linux API on Windows. Here is what is going on: Every operating system has its own set of libraries for programmers to use to make programs on that platform. In this instance, you are attempting to use Linux libraries on Windows. Windows doesn't have a code location called sys/ipc or sys/sem.
Furthermore, since you said you are a beginner, try finding another tutorial. sys/ipc.h and sys/sem.h are not for beginners, are are libraries typically used for communication between processes. These concepts are way beyond you right now haha :P
Here is a better place to start: http://www.cprogramming.com/tutorial/c-tutorial.html
I'm attempting to compile a sample c file that was given to me, but unfortunately, it's missing several libraries as some of the include files cannot find them. Namely: stropts.h, netdb.h, sys/socket.h, sys/ioctl.h, netinet/in.h, pthread.h, and unistd.h.
I've researched where I could fix these problems, but surprisingly there have been little to no results on this problem strangely. The Visual Studio command prompt isn't able to compile it until I can find these libraries. Anything I need to download/ link to fix this?
Those header files are not part of standard C or C++. Do not attempt to download the headers from other sources; even if you can get them to compile, they won't link properly since you don't have the implementations of the functions declared therein in a static library or DLL.
The simple fact of the matter is that the code you're trying to compile was written for Unix/Unix-like systems and it's not portable to Windows. You'll need to either significantly rewrite the code to use the equivalent Windows functionality or a 3rd-party platform-independent library (e.g. Winsock or Boost sockets for sockets), compile it on a Unix system (you could use a virtual machine if you want), or use a Unix compatibility layer such as Cygwin.
I want to draw a rectangle using a C program. So I was trying to use the graphics.h header. But the GCC compiler gave me a error saying that the library could not be found.
graphics.h is a header that define functions for libbgi (Borland Graphics Interface)
Unless you have a Borland compiler of some sort installed on your Mac (if that's even possible), I think you'll end up having to use other graphic libraries, or install a Windows/Linux Virtual Machine on your Mac and then run/compile your code inside it.
graphics.h is not a standard C header and is probably a part of a custom library. If you can track down that original library and provide more info, we can probably help you get it set up.