Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: who_am_i on December 09, 2019, 04:05:32 am

Title: graphics.h error
Post by: who_am_i 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....
Title: Re: graphics.h error
Post by: stahta01 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 (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 (https://github.com/nonameentername/windows-games)

Tim S.
Title: Re: graphics.h error
Post by: who_am_i 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 (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.
Title: Re: graphics.h error
Post by: stahta01 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 (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 (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.
Title: Re: graphics.h error
Post by: nicol 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/