Hey.
I am making a game for a school contest and unfortunately i have to use graphics.h and codeblocks. Im having problems with the graphics.h tho. At first i had the problem of readimagefile being undefined wich i fixed by downloading another version of graphics.h ( something was wrong with the one my teacher gave me ) but now the programm crashes when i try to initialize the window ( both using initwindow and initgraph ).
My code:
//#include <iostream>
#include <graphics.h>
//using namespace std;
[code]int main()
{
int gd = DETECT, gm;
int x = 320, y = 240, radius=100;
char s[10];
initgraph(&gd, &gm, "");
readimagefile("walk0001.gif",10,30,10,10);
}
[/code]
Things i did when installing the files:
1. I put the header files ( graphics.h and mingw.h ) in the include folder of codeblocks
2. I put the lib file ( libbgi.a ) in the lib folder
3. I put
[code]
-lbgi
-lgdi32
-lcomdlg32
-luuid
-loleaut32
-lole32
[/code]
in the linker settings.
4. I added libbgi.a using the add option in the linker settings.
5. i included the graphics.h
I also had the issue with redeclaration of int right but i was able to fix it using google ( there was a mistake in the graphics.h . They used right again instead of top )
I really dont know what to do now. If you guys need anything tell me.
See ya.
Firstly, your main function doesn't return a value.
Secondly, use "CODE" BB code.
Also, what is that?
[code]
int gd = DETECT, gm;
[/code]
[QUOTE=Nicolas;49978578]Firstly, your main function doesn't return a value.
Secondly, use "CODE" BB code.
Also, what is that?
[code]
int gd = DETECT, gm;
[/code][/QUOTE]
Dude it really doesnt matter. Honestly its something my teacher wrote and that we havent learned yet but i could literally replace everything within the main brackets exept readimagefile with initwindow and itd have the exact same effect. I had it there at the time because i was trying to solve the problem ;D
I'm taking a massive stab in the dark here, but should this:
[code]initgraph(&gd, &gm, "");[/code]
Be like this instead?
[code]initgraph(&gd, &gm, s);[/code]
If not, I'm not sure. Without knowing what this 'graphics.h' contains, it's hard to say.
You absolutely have to use graphics.h? That header hasn't been relevant since 1995.
[QUOTE=proboardslol;49983276]You absolutely have to use graphics.h? That header hasn't been relevant since 1995.[/QUOTE]
Yes. Trust me i would use opengl or ANYTHING else if i could. I have to, Otherwise my teacher wont accept it :/ . If i could use whatever I want I would probably use opengl or ogre, but i cant so i need help with this.
[editline]22nd March 2016[/editline]
[QUOTE=BackwardSpy;49983218]I'm taking a massive stab in the dark here, but should this:
[code]initgraph(&gd, &gm, "");[/code]
Be like this instead?
[code]initgraph(&gd, &gm, s);[/code]
If not, I'm not sure. Without knowing what this 'graphics.h' contains, it's hard to say.[/QUOTE]
Dude if i replace initgraph with initwindow wich does essentially the same thing exept its easier and you can set resolution, it still doesnt work. I will try that but i dont think itll help :/
do 2 things: upload a copy of graphics.h somewhere to share with us, and put the code in your op in [noparse][code][/code][/noparse] tags
[QUOTE=proboardslol;49984626]do 2 things: upload a copy of graphics.h somewhere to share with us, and put the code in your op in [noparse][code][/code][/noparse] tags[/QUOTE]
Almost done. I edited the post. Just gimme like 20 minutes. I gotta go somewhere but i ll upload the files to my vserver soon.
[editline]22nd March 2016[/editline]
[QUOTE=proboardslol;49984626]do 2 things: upload a copy of graphics.h somewhere to share with us, and put the code in your op in [noparse][code][/code][/noparse] tags[/QUOTE]
link to the mingw.h:
[url]http://134.255.217.111/_mingw.h[/url]
link to my graphics.h:
[url]http://134.255.217.111/graphics.h[/url]
link to the libbgi,a
[url]http://134.255.217.111/libbgi.a[/url]
Sorry, you need to Log In to post a reply to this thread.