I see everyone recommends just using openGL and some others but I don't wanna. I just want to know if graphic.h will only compile in turbo c and not with gcc, Thanks
Asked
Active
Viewed 1.2k times
2
-
1I believe it's a matter of DOS, not compiler. – keltar Oct 23 '13 at 09:13
2 Answers
2
You might get graphics.h
compiled (as #include
d part of some sources), but the linking (coming after the compilation) will fail, as gcc's linker (ld) would not link the compilation's result against the library (graphics.lib
) implementing what graphics.h
prototyped.

alk
- 69,737
- 10
- 105
- 255
-
Background reading for the OP: [C track: compiling C programs](http://courses.cms.caltech.edu/cs11/material/c/mike/misc/compiling_c.html) – Jongware Oct 23 '13 at 11:38
2
Of course you could compile graphics.h with gcc
but you have to follow certain steps.
- Get the files
graphics.h
from graphics andlibbgi.a
from library. - Copy the
graphics.h
file to theinclude
directory of your gcc compiler. - Copy the
libbgi.a
file to thelib
directory of your gcc compiler. Afterwards execute the code:
C:\>gcc your_filename.c -lbgi -lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32
Also if you are executing a c++ program use
g++
instead ofgcc
.

justin
- 280
- 3
- 17