![]() |
|
Trying to use Open Watcom V1.9 |
OgreVorbis
Member #21,046
September 2021
|
I'm trying to use Allegro to make DOS games. A long time ago I tried DJGPP and it wouldn't compile and was just generally sub-par. So I found this alleg.lib compiled for open watcom: I placed that in the appropriate libs folder. I then copied all the allegro include files into the watcom include "h" folder. I added the two switches to the compiler /s /3s. I figured that's all I needed to do. When I compile a small example program, it has errors cause it starts reading the aldjgpp.h file even though there is an alwatcom.h. In the program I just #include "allegro.h" So in one of the headers, it must be telling it to use the djgpp version. I thought #define ALLEGRO_WATCOM might work, but didn't. It's crazy there is a watcom header, I just can't make it use it. Maybe there will be more errors down the road, but I want to keep trying. |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
Check if it was actually compiled for Watcom by using ALLEGRO_DJGPP and ALLEGRO_WATCOM macros. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
OgreVorbis
Member #21,046
September 2021
|
Thanks for getting back so fast. I did define ALLEGRO_WATCOM, so how should I check if it's defined, you mean like ifdef. Is there anything I should put in the linker/compiler options? I just put that define right at the beginning of the main source. BTW I am not an ultimate C programmer. I mostly use C#, so it's possible I'm doing something wrong, but I am skilled enough to use allegro. |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
ALLEGRO_DJGPP and ALLEGRO_WATCOM are defined by the build process. You should not define them yourself. If you can't compile a simple hello allegro program that includes allegro.h, then you probably need to recompile allegro yourself for WATCOM. If it's including aldjgpp.h something is definitely wrong. EDIT My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
DanielH
Member #934
January 2001
![]() |
OgreVorbis said: So I found this alleg.lib compiled for open watcom: Did you follow the instructions on that page for compiling Allegro? I've only used DHGPP for DOS, so cannot help with compiling for Watcom. |
OgreVorbis
Member #21,046
September 2021
|
I FIGURED IT OUT! Two problems: 2. This is the big one. The alleg.lib file does NOT go under "Library Files" in the linker switches. It goes under "Libraries" instead. I found this confusing cause I don't know the purpose of that. So to anyone who wants to do this: That should do it. Now you can just add the exhello.c (hello world example) to your project and do a makeall. Copy DOS/4GW.exe into the program's folder and run DOSBox. It's working! |
OgreVorbis
Member #21,046
September 2021
|
FFFFFFFFFFFFF. No, it doesn't FULLY work, I was mistaken. For some reason it only works with the simple hello world, but for anything more than that, it doesn't work at all. I figured the hello world would be enough to show it working, but NO! exhello.c(38): Error! E1058: Cannot use typedef 'BITMAP' as a variable And, there's more... |
amarillion
Member #940
January 2001
![]() |
If a symbol is not declared, then you're probably not including the right header files. Can you share some code? -- |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
amarillion - It looks like the standard Windows conflicts. Perhaps including <alwin.h> would fix it? EDIT My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
OgreVorbis
Member #21,046
September 2021
|
The code is just an extension of the exhello.c I'm now just trying to display an image on the screen. 1#include <allegro.h>
2
3int main(void)
4{
5 /* you should always do this at the start of Allegro programs */
6 if (allegro_init() != 0)
7 return 1;
8
9 /* set up the keyboard handler */
10 install_keyboard();
11
12 /* set a graphics mode sized 320x200 */
13 if (set_gfx_mode(GFX_VESA3, 640, 480, 0, 0) != 0) {
14 allegro_message("Unable to set any graphic mode\n%s\n", allegro_error);
15 return 1;
16 }
17
18 /* set the color palette */
19 //set_palette(desktop_palette);
20
21 /* clear the screen to white */
22 clear_to_color(screen, makecol(255, 255, 255));
23
24 /* you don't need to do this, but on some platforms (eg. Windows) things
25 * will be drawn more quickly if you always acquire the screen before
26 * trying to draw onto it.
27 */
28 //acquire_screen();
29 BITMAP *bmp;
30 PALETTE pal;
31 bmp = load_bitmap("MOUNTAIN.PCX", pal);
32 set_palette(pal);
33 blit(bmp, screen, 0, 0, 0, 0, bmp->w, bmp->h);
34
35 /* write some text to the screen with black letters and transparent background */
36 textout_centre_ex(screen, font, "Hello, world!", SCREEN_W/2, SCREEN_H/2, makecol(0,0,0), -1);
37
38 /* you must always release bitmaps before calling any input functions */
39 release_screen();
40
41 /* wait for a key press */
42 readkey();
43
44 destroy_bitmap(bmp);
45
46 return 0;
47}
48
49END_OF_MAIN()
|
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
BITMAP and PALETTE are also defined by windows.h but I don't see you including that anywhere. I'm guessing you need to declare them as a struct BITMAP and struct PALETTE. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Peter Hull
Member #1,136
March 2001
|
Did you try including winalleg.h instead of allegro.h? [edit] oops1 - sorry Edgar you'd already suggested that, oops2 - sorry Ogre you did mention you were making DOS games in your first post
|
OgreVorbis
Member #21,046
September 2021
|
I can't post an update here anymore. Maybe the thread was locked, so I edit this post. The reason was that this is C89 and doesn't support declaring variables in the middle of a code block. The variables all had to be moved to the top AND IT'S NOW WORKING PERFECTLY 100%. Original post: No, none of that worked. Same results. |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
You can't reply to your own post to prevent double posting. You can however edit your post and send it to the top. Now that I've replied, you can reply again. I'm interested in getting Watcom to work, since CMake supports Watcom WMake files. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
|