Need help with graphics.h in XP

jrobinson3k1
jrobinson3k1 used Ask the Experts™
on
How do I get graphics.h and DOS to work on XP? If I remember right, DOS doesn't come with XP, correct? I am using Borland Builder 6. I know graphics.h doesn't come with Builder 6, but I copied the graphics file from my old borland and it still wouldn't work. Thanks.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
efn

Commented:
Somebody else had a similar question six months ago.  Maybe this will help:

http://www.experts-exchange.com/Programming/Programming_Languages/Cplusplus/Q_20598755.html
I can help you . I had the same problem I guess that you are using a windows compiler meaning BGI graphics will not work unless you have a dos compiler. Also if im right XP does not even include dos so you could not get one any way . If you want my advice look into OpenGL .

Author

Commented:
Well I know its possible cuz I know of people that do it, but I cannot get a hold of them to know. The website efn gave me seemed that it WOULD work, only problem is that the website doesnt host those files anymore. If I could get a more efficient direct link I will dish out the points.
Introduction to R

R is considered the predominant language for data scientist and statisticians. Learn how to use R for your own data science projects.

efn

Commented:
The WINBGIM files are available from

http://www.cs.colorado.edu/~main/bgi/

WINBGIM is based on WinBGI, which is available from the bottom of this page:

http://www.garret.ru/~knizhnik/winbgi.zip

--efn

Author

Commented:
I can't seem to get it to work w/ Borland 6. I'm having trouble finding the options to get it how it needs to be for winbgim.h to work. When I try to run a program with it the only errors I get are relating to multiple declarations for all the colors disputing between the winbhim.h and conio.h headers. Any ideas?
efn

Commented:
I don't think we can help you without more information.  For what it's worth, I made a console application that included both conio.h and winbgim.h and it compiled without error in C++Builder 4.  It didn't actually do anything, though.

--efn

Author

Commented:
Well what more do you need to know and I can tell you. Do you have Borland 6 or familar w/ it?

Author

Commented:
Is OpenGL like BGI, just more modern for Windows?
efn

Commented:
> Well what more do you need to know and I can tell you.

Are you working with a console application?  Have you tried to make a minimal test program that just includes those two files and doesn't do anything?  Have you tried repeatedly cutting pieces of your program out until it compiles?  Exactly what error messages are you getting?  What is the code that is generating the messages?

For general advice on how to ask for programming help, see:

http://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.8

Have you tried any of the WINGBGIM sample code?  Since I posted my last comment, I tried the sample code from the documentation on the kbhit function.  After I corrected one error, it compiled and ran.

> Do you have Borland 6 or familar w/ it?

No, but this technology is so old that I doubt that it matters.  It could, though.

--efn

Author

Commented:
Are you working with a console application?  Yes
Have you tried to make a minimal test program that just includes those two files and doesn't do anything?  Yes
Have you tried repeatedly cutting pieces of your program out until it compiles?  Yes
Exactly what error messages are you getting?  What is the code that is generating the messages? There is no errors in my cpp file, but the errors lie in a conflict between conio.h and winbgim.h. I don't even include conio.h and it loads it up. I guess winbgim.h uses conio.h, I didn't look for that. The errors, as I stated, are multiple declarations of the colors (eg. BLACK, BLUE, RED, etc.), since winbgim.h AND conio.h declare the colors.

I haven't had Borland 6 long, so I don't know how to tell the project to function to run BGI, use Win32, use the dynamic library, or any of that stuff. The reason I want to be able to use graphics.h functions is because at school (where I am now) we use Borland 5.02 and we use BGI graphics (Yes, its out-of-date, but I go to a small high school so it's all we got). At home, I have Borland 6, so that conflicts between my school programs and home programs and I want to be able to take my programs from school and edit them at home and compile and run them.

Author

Commented:
OK, everything works fine w/ winbgim at school, which runs Borland 5.02. I think my problem is getting all the settings for my project right, so I need to figure out how to change my options for that. I'll try it later when I get home. I appreciate all your help so far.

Author

Commented:
increasing points to 100
efn

Commented:
You must have either _WINDOWS_H or _GNU_H_WINDOWS_H defined in your environment.  I bet if you get them undefined, the compile errors will go away.

Edited from winbgim.h:

#if defined(_WINDOWS_H) || defined(_GNU_H_WINDOWS_H)
    /* MINGW32 G++ Compiler:
    *  Define the colors type in the same way that Borland does.
    */
    enum colors {
        BLACK, BLUE, GREEN, CYAN, RED, MAGENTA, BROWN, LIGHTGRAY, DARKGRAY,
        LIGHTBLUE, LIGHTGREEN, LIGHTCYAN, LIGHTRED, LIGHTMAGENTA, YELLOW, WHITE
    };
#else
    /* BORLAND Compiler:
    * Colors are already defined in the BC5 conio.h, using COLORS.
    * So for Borland I'll replace this enum with a #define definition.
    */
    #define colors COLORS
#endif

I was able to reproduce your problem by adding this line to my program before #include "winbgim.h":

#define _WINDOWS_H

--efn

Author

Commented:
I must of got an edited version of winbgim.h somehow, because right above the color declarations is #define _WINDOWS_H. I took that like out of the header file and atleast I got a few less errors, lol. I included winbgim.h and put void main() and tried to compile and I got these errors:

[Linker Error] Unresolved External '__InitVCL' referenced from D:\BORLAND\LIB\CP32MTI.LIB]crtlvcl
[Linker Error] Unresolved External '__ExitVCL' referenced from D:\BORLAND\LIB\CP32MTI.LIB]crtlvcl
Commented:
It looks like it thinks you want to use the Borland Visual Component Library, but you are not linking it in.  Since this is supposed to be a console application, I'd suggest you look for something that is trying to use the VCL and remove it.  If you have a #include <vcl.h> somewhere, you could remove it and see what doesn't compile.  You could look at the project options too.

I hope the fact that you are reporting a linker error means that you got it to compile.

--efn

Author

Commented:
it compiles but it does not run. And I can't fine anywhere where the VCL is included since I'm just compiling the include of that header file and thats it. Perhaps its impossible to get winbgim to work on Borland 6? Because I'm fresh out of ideas of what to try.
efn

Commented:
Have you tried any of the sample code from the winbgim documentation?

Author

Commented:
Sorry for the absense, was gone all weekend. Yes, the winbgim.cpp file won't work either. I get the same linker errors.
efn

Commented:
I don't know what else to suggest.  For what it's worth, by "sample code," I didn't mean winbgim.cpp, which builds the library itself, but separate sample programs in the documentation.  The one I built was in the documentation on kbhit().

--efn

Commented:
No comment has been added lately, so it's time to clean up this question.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: efn {http:#9639880}

Please leave any comments here within the next four days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Tinchos
EE Cleanup Volunteer

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial