| | |
Grrr C++ Help Me!
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: May 2005
Posts: 2
Reputation:
Solved Threads: 0
Ok hey, I have this program and i dont understand how Its not wiorking.
Thx for your time. :o
Thx for your time. :o
C++ Syntax (Toggle Plain Text)
#include <allegro.h> #include <stdio.h> #include <stdlib.h> #include <time.h> void main() { int x,y,bx,by,af,al,ar,ab; allegro_init(); install_keyboard(); install_timer(); set_color_depth(16); set_gfx_mode(GFX_AUTODETECT,800,600,0,0); BITMAP *buffer, *back, *a, *b, *c, *d, *e, *f, *g, *h; back=load_bitmap("back.bmp",0); a=load_bitmap("gob-front-1.bmp",0); b=load_bitmap("gob-front-2.bmp",0); c=load_bitmap("gob-back-1.bmp",0); d=load_bitmap("gob-back-2.bmp",0); e=load_bitmap("gob-left-1.bmp",0); f=load_bitmap("gob-left-2.bmp",0); g=load_bitmap("gob-right-1.bmp",0); h=load_bitmap("gob-right-2.bmp",0); x=300; y=250; bx=0; by=0; af=1; al=1; ar=1; ab=1; buffer=create_bitmap(800,600); while(!key[KEY_ESC]) { sit(); } } END_OF_MAIN() void sit(); { if(af == 1) { blit(buffer,screen, 0, 0, 0, 0, 800,600); draw_sprite(buffer,back,bx,by); draw_sprite(buffer,a,x,y); delay (100); af=0; } if(af == 0) { blit(buffer,screen, 0, 0, 0, 0, 800,600); draw_sprite(buffer,back,bx,by); draw_sprite(buffer,b,x,y); delay (100); af=1; } } } int left(); { while(key[KEY_LEFT]) { if(al == 1) { blit(buffer,screen, 0, 0, 0, 0, 800,600); draw_sprite(buffer,back,bx,by); draw_sprite(buffer,e,x,y); bx = bx + 1; delay (100); al=0; } if(al == 0) { blit(buffer,screen, 0, 0, 0, 0, 800,600); draw_sprite(buffer,back,bx,by); draw_sprite(buffer,f,x,y); bx = bx + 1; delay (100); al=1; } } } int right(); { while(key[KEY_RIGHT]) { if(ar == 1) { blit(buffer,screen, 0, 0, 0, 0, 800,600); draw_sprite(buffer,back,bx,by); draw_sprite(buffer,g,x,y); bx = bx - 1; delay (100); ar=0; } if(ar == 0) { blit(buffer,screen, 0, 0, 0, 0, 800,600); draw_sprite(buffer,back,bx,by); draw_sprite(buffer,h,x,y); bx = bx - 1; delay (100); ar=1; } } } int back(); { while(key[KEY_UP]) { if(ab == 1) { blit(buffer,screen, 0, 0, 0, 0, 800,600); draw_sprite(buffer,back,bx,by); draw_sprite(buffer,c,x,y); bx = by + 1; delay (100); ab=0; } if(ab == 0) { blit(buffer,screen, 0, 0, 0, 0, 800,600); draw_sprite(buffer,back,bx,by); draw_sprite(buffer,d,x,y); bx = by + 1; delay (100); ab=1; } } } int front(); { while(key[KEY_DOWN]) { if(af == 1) { blit(buffer,screen, 0, 0, 0, 0, 800,600); draw_sprite(buffer,back,bx,by); draw_sprite(buffer,a,x,y); bx = by - 1; delay (100); ab=0; } if(af == 0) { blit(buffer,screen, 0, 0, 0, 0, 800,600); draw_sprite(buffer,back,bx,by); draw_sprite(buffer,b,x,y); bx = by - 1; delay (100); ab=1; } } } void delay(clock_t wt) { clock_t t1, t2; t1 = clock(); t2 = clock(); while (t2 - t1 <= wt) { t2 = clock(); } }
Although I have no idea, i have taken the liberty of compling it to see the problem.
Please be more specific Zackery. It is hard to determine a problem if we haven't even seen the compile log. Here is the compile log from Dev-C++:
Please be more specific Zackery. It is hard to determine a problem if we haven't even seen the compile log. Here is the compile log from Dev-C++:
C++ Syntax (Toggle Plain Text)
Compiler: Default compiler Building Makefile: "C:\Dev-Cpp\Makefile.win" Executing make... make.exe -f "C:\Dev-Cpp\Makefile.win" all g++.exe -c Untitled2.cpp -o Untitled2.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include" Untitled2.cpp:2: error: `main' must return `int' Untitled2.cpp: In function `int main(...)': Untitled2.cpp:6: error: `allegro_init' undeclared (first use this function) Untitled2.cpp:6: error: (Each undeclared identifier is reported only once for each function it appears in.) Untitled2.cpp:7: error: `install_keyboard' undeclared (first use this function) Untitled2.cpp:8: error: `install_timer' undeclared (first use this function) Untitled2.cpp:9: error: `set_color_depth' undeclared (first use this function) Untitled2.cpp:10: error: `GFX_AUTODETECT' undeclared (first use this function) Untitled2.cpp:10: error: `set_gfx_mode' undeclared (first use this function) Untitled2.cpp:13: error: `BITMAP' undeclared (first use this function) Untitled2.cpp:13: error: `buffer' undeclared (first use this function) Untitled2.cpp:13: error: `back' undeclared (first use this function) Untitled2.cpp:13: error: `a' undeclared (first use this function) Untitled2.cpp:13: error: `b' undeclared (first use this function) Untitled2.cpp:13: error: `c' undeclared (first use this function) Untitled2.cpp:13: error: `d' undeclared (first use this function) Untitled2.cpp:13: error: `e' undeclared (first use this function) Untitled2.cpp:13: error: `f' undeclared (first use this function) Untitled2.cpp:13: error: `g' undeclared (first use this function) Untitled2.cpp:13: error: `h' undeclared (first use this function) Untitled2.cpp:15: error: `load_bitmap' undeclared (first use this function) Untitled2.cpp:35: error: `create_bitmap' undeclared (first use this function) Untitled2.cpp:38: error: `key' undeclared (first use this function) Untitled2.cpp:38: error: `KEY_ESC' undeclared (first use this function) Untitled2.cpp:40: error: `sit' undeclared (first use this function) Untitled2.cpp: At global scope: Untitled2.cpp:48: error: expected constructor, destructor, or type conversion before "void" Untitled2.cpp:48: error: expected `,' or `;' before "void" Untitled2.cpp:49: error: expected unqualified-id before '{' token Untitled2.cpp:49: error: expected `,' or `;' before '{' token Untitled2.cpp:68: error: expected declaration before '}' token make.exe: *** [Untitled2.o] Error 1 Execution terminated
>> Here is the compile log from Dev-C++:
That's assuming that Zackery doesn't have Allegro installed, which he probably does. Almost all of those errors and warnings have to do with you not compiling and linking correctly with a third party library.
>> i dont understand how Its not wiorking
How is it not working? Do you get compiler errors? Linker errors? Run-time errors? Is the output just not what you expected? Your question is too vague.
That's assuming that Zackery doesn't have Allegro installed, which he probably does. Almost all of those errors and warnings have to do with you not compiling and linking correctly with a third party library.
>> i dont understand how Its not wiorking
How is it not working? Do you get compiler errors? Linker errors? Run-time errors? Is the output just not what you expected? Your question is too vague.
![]() |
Similar Threads
- ALL GMail invites to be posted here please! (Geeks' Lounge)
- Mac, "Plug In," (OS X)
- Mobility Radeon is Unstable (Windows NT / 2000 / XP)
- html#37409 pesky error (Viruses, Spyware and other Nasties)
- Blocking Downloads using XP??? (Windows NT / 2000 / XP)
- Help removing bridge.dll (Viruses, Spyware and other Nasties)
- Plug and play dissapeared (Windows NT / 2000 / XP)
- Suddenly my system is slooow... Only with CloneCD tho (Windows NT / 2000 / XP)
- For those of you who need a website database! (ASP.NET)
Other Threads in the C++ Forum
- Previous Thread: How to make standalone exe
- Next Thread: vc++ mfc-i can't make getline work with a string for file input
| Thread Tools | Search this Thread |
api array based binary bitmap c++ c/c++ calculator char char* class classes code coding compile console conversion count database delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int java lib linkedlist linker linux list loop looping loops map math matrix memory multiple news node number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings temperature template templates test text text-file tree unix url variable vector video visualstudio win32 windows winsock word wordfrequency wxwidgets





