Menu

#include <winbgim.h>

2002-12-19
2012-09-26
  • Nobody/Anonymous

    What are some good websites and/or tutorials to learn about how to use #include <winbgim.h>

     
    • Nobody/Anonymous

      www.google.com

      Google is our friend!

      Wayne

       
    • upcase

      upcase - 2002-12-19

      Hmmm... use #include <winbgim.h>??
      Do it like this in your source file:

      ....some includes...
      #include <wingbim.h>
      ...some code.....
      :-)

      What is that wingbim header file for anyway?

       
    • Nobody/Anonymous

      Rene,

      You are setting a bad example dude!  Ok, since noone else seems to want to use google, here is some information I found thereby:

      How do I use Borland Graphics Interface (graphics.h)?
      For those of you migrating from Borland, you may be wondering where graphics.h is. Unfortunately, graphics.h is a Borland specific library and cannot be used with Dev-C++. Fortunately, a benevolent soul by the name of Michael Main has modified a BGI emulation library for Windows applications (originally written by Konstantin Knizhnik) to be used under MinGW (and Dev-C++) which he has aptly named WinBGIm.

      The files we need are:
      winbgim.h  (download to /Dev-C++/include) 
      winbgim.cpp  (download to /Dev-C++/include) 
      libbgi.a  (download to /Dev-C++/lib) 

      After you have downloaded the files to the correct locations, you can now use winbgim.h as you would graphics.h with a few caveats.

      Using library files:
      First, you have to tell Dev-C++ where to find the library functions that WinBGIm references--this is done in the "Project Options" dialog box.
      Here are instructions on how to do this with a new project:

      Follow step 2 and step 3 of "Using Dev-C++".
      Go to "Project" menu and choose "Project Options" (or just press ALT+P).
      In the "Further object files or linker options" field, enter: -lbgi -lgdi32

      Click "OK".
      Follow step 4, step 5 and step 6 of "Using Dev-C++".
      BGI and WinBGIm differences:
      WinBGIm is a superset of BGI and as such may have functions and features with which you are unfamiliar. See Michael Main's BGI Documentation for more information.

      Test code:
      Just to make sure you've got everything set up correctly, try this test code in a new Dev-C++ WinBGIm project:

        #include <winbgim.h>

        int main()
        {
            initwindow(400,300); //open a 400x300 graphics window
            moveto(0,0);        
            lineto(50,50);      
            while(!kbhit());     //wait for user to press a key
            closegraph();        //close graphics window
            return 0;
        }If you've done everything correctly, you should get a simple graphic that closes when the user presses a key.

      This is a cut and paste job, formatting probably stinks...

      Wayne

       
      • Nobody/Anonymous

        When i compiled the test code,it displayed the follow message:
        [linker error]undefined reference to 'initwindow'
        [linker error]undefined reference to 'moveto'
        [linker error]undefined reference to 'lineto'
        [linker error]undefined reference to 'closegraph'
        How can i do now?
        Thanks!!

         
    • upcase

      upcase - 2002-12-20

      Sorry Wayne.. Surely didn't want to hurt someones feelings..
      I'll restrain myself next time.

      Bye!

       
    • Curtis Sutter

      Curtis Sutter - 2002-12-20

      Second result using Google and "winbgim.h"
      http://www.cs.colorado.edu/~main/bgi/
      I highly recomend this site.  It has examples and covers all of the functions in the winbgim file.  To create a BGI type interface, new project -> other -> Console GDI.  For a example you can view my War Card Game, ftp://curtis.servebeer.com/Source_Code/War_Cardgame/ and my newest (a game taken from my friends phone) Push Push ftp://curtis.servebeer.com/Source_Code/Push_Push/

      I will add new levels to Push Push soon, I have them on paper (up to 18) but need to type them in.
      Both games require you to get all of the files to run them.
      I also teach through NetMeeting and/or give assistance.  You can contact me by means of the Contact List.

      Curtis

      P.S.  Itried to post this yesterday, but sorceforge went down for a bit.

       
    • Wayne Keen

      Wayne Keen - 2003-12-08

      Describing step by step where you got things and where you put them would help.

      A full compile log would be helpful.  Note full does not mean just the errors.  The right mouse button can be used to copy.

      And copy and paste the code that you tried to compile.

      Wayne

       
    • Wayne Keen

      Wayne Keen - 2003-12-08

      I am running Dev 4.9.8.5, on Windows XP Home.  I got the winbgi stuff though one of the Dev Packs, I forgot which.  Now, I checked to see if the header file and the cpp file (winbgim.h and winbgim.cpp)were in c:\dev-cpp\include.  They were.  I then checked the lib directory for libbgi.a.  Check, its there...

      I copied the test code, opened Dev, created a New:Source File and [asted this code in:

      #include <winbgim.h>

      int main()
      {
      initwindow(400,300); //open a 400x300 graphics window
      moveto(0,0);
      lineto(50,50);
      while(!kbhit()); //wait for user to press a key
      closegraph(); //close graphics window
      return 0;
      }

      (Note I am not using a project).  Now, I went to Tools:Compiler Options:Compiler and added to the box labled "Add The Follwing Commands When Calling The Compiler"

      -lbgi -lgdi32

      And compiled.  Here is my compile log:

      Compiler: Default compiler
      Executing  g++.exe...
      g++.exe "C:\Dev-Cpp\gbi.cpp" -o "C:\Dev-Cpp\gbi.exe"   -lbgi -lgdi32 -traditional-cpp  -I"C:\Dev-Cpp\include\c++"  -I"C:\Dev-Cpp\include\c++\mingw32"  -I"C:\Dev-Cpp\include\c++\backward"  -I"C:\Dev-Cpp\include"   -L"C:\Dev-Cpp\lib"
      Execution terminated

      It ran fine.  (Which surprised me a bit, since the original post is like a year old)

      Never forget, when you are having trouble with an error, ALWAYS post the following basic information

      (1) What version of Dev you are using, with what OS
      (2) Post simple example code that shows the effect
      (3) Post your full compile log, NOT just the errors

      And try to think like someone trying to solve a problem.  For example, in the directions you are following, a big point is made about getting the right files in the right places.  You mentioned nothing about what you did, and where things went.

      A report which just features errors and asks "what can I do now" is not doing enough to put the folks trying to help you there with you...so they can help you.  Think like a problem solver.  Before long, you will be solving MY problems.

      Wayne

       
    • Wayne Keen

      Wayne Keen - 2003-12-08

      I think it might have been the clgdi devpak that the files came from...

      Wayne

       
    • Anonymous

      Anonymous - 2003-12-08

      From "When i compiled the test code,it displayed the follow message:
      [linker error]undefined reference to 'initwindow'
      [linker error]undefined reference to 'moveto'
      [linker error]undefined reference to 'lineto'
      [linker error]undefined reference to 'closegraph'
      How can i do now?"

      It looks like you have omitted to link the library. If you use the clgdi DevPack (which packages wingbim for Dev-C++), you should start with the clgdi project template which links the appropriate libaries. Starting with a console app templet will not work because the Win32 GDI library is required, and this normally only gets linked for GUI apps.

      You can of course set it up manually, using the documentation on the authors site: http://www.cs.colorado.edu/~main/bgi/README.html

      Clifford.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.