0

I installed graphics.h library on Dev-C++ but it wont run my code as it gives me this error in the compiler:

int left=0,
int right=0,
int right=INT_MAX,
int bottom=INT_MAX,

Here's my code:

#include <graphics.h>
void main( )
{

 initwindow(800, 800, "line");
 line(200,200,200,600);
 getch();
}

They told me graphics.h can't work on 64-bit windows... Is that right?...

genpfault
  • 51,148
  • 11
  • 85
  • 139
  • 3
    What's `graphics.h`? – Matthieu Brucher Nov 26 '18 at 12:23
  • 2
    `graphics.h` is not standard C header. Where did you get it? – user694733 Nov 26 '18 at 12:25
  • Have you googled this? – Romain Hippeau Nov 26 '18 at 12:25
  • 3
    @MatthieuBrucher Apparently it's a [graphics library](https://stackoverflow.com/questions/7860569/how-i-can-get-and-use-the-header-file-graphics-h-in-my-c-program) old enough to be considered "antique". – Arnav Borborah Nov 26 '18 at 12:25
  • _"it give me this error in the compiler"_ I don't see the error? Please paste the full error. – TrebledJ Nov 26 '18 at 12:26
  • What is the error? Who is "they"? Why are you using antiques? Assuming you mean the graphics.h from Turbo C++, that is literally from the 1980s. – Lightness Races in Orbit Nov 26 '18 at 12:32
  • when i compile it opens a new tab named graphics.h and it highlight this text: int left=0, int right=0, int right=INT_MAX, int bottom=INT_MAX, – Ezzeddine Saaid Nov 26 '18 at 12:38
  • my teacher told me it can't work on 64 bit windows,also sorry for my bad english – Ezzeddine Saaid Nov 26 '18 at 12:39
  • Listen to your teacher. graphics.h is an old MS DOS VGA graphics library for the Turbo C compiler. Unless you plan to become a maintainer of old DOS junk, I would suggest that you pick up some more modern graphics lib. – Lundin Nov 26 '18 at 12:44
  • ok fine, the graphics.h is a subject in my univercity is there any similar library i can study on it that run on 64bit win? – Ezzeddine Saaid Nov 26 '18 at 12:48
  • 1
    @EzzeddineSaaid [SFML](https://www.sfml-dev.org/) – PaulMcKenzie Nov 26 '18 at 12:51
  • You should ask your teacher how to configure your compiler to build for 32-bit Windows environment. – Kit. Nov 26 '18 at 12:52
  • thanks for help everyone :) – Ezzeddine Saaid Nov 26 '18 at 12:53
  • 2
    If you don't visit this university for it's history classes, I'd suggest also getting a good, recent book on C or C++ to study what you will need for the job. Turbo C++ is what the donkey cart is to modern engineering. It was good at the time, but we don't live in those times any more. Even the combustion engine is on it's way out, don't learn how to drive a donkey cart. – nvoigt Nov 26 '18 at 13:29
  • Consider using C++11 (with a recent [GCC](http://gcc.gnu.org/) or [Clang](http://clang.llvm.org/) compiler) and [Qt](http://qt.io/) – Basile Starynkevitch Nov 26 '18 at 13:49
  • Consider replacing `,` with `;` for your declarations. Another idea is to remove `int` for additional variables (e.g. `int a, b, c;`). – Thomas Matthews Nov 26 '18 at 15:31

2 Answers2

2

WinBGIm is a 32-bit library only. There were no 64-bit version of Windows (except for the Itanium) when it was written.

Kit.
  • 2,386
  • 1
  • 12
  • 14
2

If anyone download this from the official site, open the graphics.h in any text editor, and exactly at line 303:

int left=0, int right=0, int right=INT_MAX, int bottom=INT_MAX

change the second right to top (redeclaration error).

This library will only run on x32 bit compilers. So if you're running something ancient like Bloodshed DevC, Turbo C, or CodeBlocks, then you're fine. But if you're using Visual Studio and your assigments force you to use that library, then good luck making that happen.

Walter
  • 33
  • 1
  • 3
  • 5