Author Topic: graphics.h error  (Read 1667 times)

Offline who_am_i

  • Single posting newcomer
  • *
  • Posts: 4
graphics.h error
« on: December 09, 2019, 04:05:32 am »
I'm trying to use "graphics.h" just for learning purpose. I'm trying to draw a line but "Code Block 17.12" gives error:

fatal error: graphics.h: No such file or directory


As Code Block by default doesn't have "graphics.h". So, I followed One tutorial tom setup graphics.h in Code Block which has the following steps.

1. Download "WinBGIm_Library6_0_Nov2005.rar" from http://winbgim.codecutter.org/

2. After extraction put "graphics.h" & "winbgim.h" in "C:\Program Files\CodeBlocks\MinGW\include" folder

3. "libbgi.a" in "C:\Program Files\CodeBlocks\MinGW\lib" folder

4. Setting -> Compiler -> Global compiler setting
5.under "Link Libraries" section add
"C:\Program Files\CodeBlocks\MinGW\include"

6. under "Other linker options" section add
-lbgi -lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32

7. Open "graphics.h" from "C:\Program Files\CodeBlocks\MinGW\include" in notepad and jump to line 302 and edit it to

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

Please tell whats the problem....

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6911
    • My Best Post
Re: graphics.h error
« Reply #1 on: December 09, 2019, 04:10:14 am »
You are likely following bad directions; but, since I did not read them I can not be sure.

I created a git repo to help on this problem a long while back.
https://github.com/stahta01/windows-games

You might wish to see if any of the forks are better than what I did.
Edit none of the forks on my work look like they did anything.
You still might look at where I forked from https://github.com/nonameentername/windows-games

Tim S.
« Last Edit: December 09, 2019, 04:14:08 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline who_am_i

  • Single posting newcomer
  • *
  • Posts: 4
Re: graphics.h error
« Reply #2 on: December 09, 2019, 04:14:49 am »
You are likely following bad directions; but, since I did not read them I can not be sure.

I created a git repo to help on this problem a long while back.
https://github.com/stahta01/windows-games

You might wish to see if any of the forks are better than what I did.

Tim S.
please don't reply if you didn't read the problem.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6911
    • My Best Post
Re: graphics.h error
« Reply #3 on: December 09, 2019, 04:19:28 am »
Post read and follow the rules for this website.
I do not know if you broke the rules; but, you likely will in the future.
http://forums.codeblocks.org/index.php/topic,9996.0.html

Also, read how to report a problem FAQ.

http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F

please don't reply if you didn't read the problem.
Since, I am usually the only one to help with this problem you just pissed off the wrong person!

Edit2: My first post is enough for a reasonable knowledgeable person to fix the slightly off topic question for this site. Note: Most newbie do not know how to use git repos; so, it only seems to work as a answer 25 percent of the time. So, we now need to play twenty questions; a game that I hate. But, I will let some else help you if you ever post a full rebuild log.

Tim S.
« Last Edit: December 09, 2019, 04:34:06 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline nicol

  • Single posting newcomer
  • *
  • Posts: 2
Re: graphics.h error
« Reply #4 on: May 13, 2020, 06:49:47 am »
Your error will resolved after reading this article: https://erainnovator.com/how-to-include-graphics-h-in-codeblocks/

Offline fielch

  • Single posting newcomer
  • *
  • Posts: 1
Re: graphics.h error
« Reply #5 on: May 26, 2020, 09:52:25 am »
Using the angle brackets "<>" assumes graphics.h is part of the C standard library. After some research, it appears this file is no longer included in the library. If you wish to continue using this library, you will have to find graphics.h and place it in the same location as your source code.


tellthebell
« Last Edit: May 27, 2020, 06:41:16 am by fielch »