exe file workin on one PC but not on another?

This is a discussion on exe file workin on one PC but not on another? within the C Programming forums, part of the General Programming Boards category; Hi! I made a game in C using graphics recently. It works perfectly alright on my PC but when I ...

  1. #1
    Registered User
    Join Date
    Jul 2003
    Posts
    3

    Question exe file workin on one PC but not on another?

    Hi!

    I made a game in C using graphics recently. It works perfectly alright on my PC but when I mailed it to my friends, on their PC the exe file is not working, its giving "BGI error:Graphics not initialised".

    As far as I know while initialising using initgraph we can write in two formats:

    int gd=detect,gm;

    initgraph(&gd,&gm,"c:\\tc\\bgi");

    OR

    initgraph(&gd<&gm," ");

    but my compiler does not accepts this second option.On doing so it gives me the same error of "BGI error:...." .

    Is this in any way related to my problem?
    If my friends do not have Turbo C++ will they not be able to run this .exe file?
    Infact all my friends have Turbo C++ yet this .exe file is not working on their PC.

    What is the reason?
    I am sure I'll get some solutin to my problem soon through you people.

    Aarti

  2. #2
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    There are two ways around this:

    • Copy the correct BGI driver into the correct directory on the other system.
    • Use the included utilities with TC that allows you to add the correct BGI driver to one of the linked libraries - thus the host computer does not need the BGI file because it is included in the link. Check your help file from within the Turbo C++ IDE - start with initgraph() and link from there - you should find it easily.

  3. #3
    Been here, done that.
    Join Date
    May 2003
    Posts
    1,157
    Originally posted by Bubba
    Use the included utilities with TC that allows you to add the correct BGI driver to one of the linked libraries...
    The utility is BGIOBJ.EXE and it will convert it to an OBJ file which can be linked directly into your program -- no need to add it to a library if you don't want to.
    Definition: Politics -- Latin, from
    poly meaning many and
    tics meaning blood sucking parasites
    -- Tom Smothers

  4. #4
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    Roger.

    Haven't used the thing in so long I forgot what it was called. Thanks for the clarification WaltP.

  5. #5
    Its not rocket science vasanth's Avatar
    Join Date
    Jan 2002
    Posts
    1,683
    make this line
    initgraph(&gd,&gm,"c:\\tc\\bgi"); to initgraph(&gd,&gm,""); and place the file EGAVGA.BGI in the same folder as the EXE.. this will solve the problem... but the best solution is to link it with the exe

  6. #6
    Registered User
    Join Date
    Jul 2003
    Posts
    102

    Hi

    Hi,
    You can do this thing. Copy all the *.bgi files and *.chr (for font) files in your source dode directory itself and make initgraph(&gd,&gm,"");. Then compile and run the program. If everything goes fine you copy send that exe file and all the *.bgi and *.chr files to your friend and ask them to place those files with in that directory itself.
    Saravanan.
    Saravanan.T.S.
    Beginner.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File Writing Problem
    By polskash in forum C Programming
    Replies: 3
    Last Post: 02-13-2009, 09:47 AM
  2. Data Structure Eror
    By prominababy in forum C Programming
    Replies: 3
    Last Post: 01-06-2009, 08:35 AM
  3. Formatting the contents of a text file
    By dagorsul in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2008, 12:36 PM
  4. gcc link external library
    By spank in forum C Programming
    Replies: 6
    Last Post: 08-08-2007, 03:44 PM
  5. Encryption program
    By zeiffelz in forum C Programming
    Replies: 1
    Last Post: 06-15-2005, 03:39 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21