Dos Box

This is a discussion on Dos Box within the C Programming forums, part of the General Programming Boards category; Hi Guys Have any of you tried running your C programs using DOSBOX in WINDOWS 7,I have installed it lately ...

  1. #1
    Registered User
    Join Date
    Feb 2011
    Posts
    14

    Unhappy Dos Box

    Hi Guys
    Have any of you tried running your C programs using DOSBOX in WINDOWS 7,I have installed it lately but I keep getting the error "unable to open include file "stdio.h" for all the header files.Please Help.
    Thank YOU

  2. #2
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Obviously, the header file is not where your compiler is looking for it. I haven't used DOSBOX, but if you open a console window, from inside DOSBOX, you should be able to find the header files, and then get your compiler looking in the right place.

    Rather than go through all this, you might want to consider a better set up (imo):
    smorgasbordet - Pelles C

    Has version just for Window 7, if you like.

  3. #3
    Registered User
    Join Date
    Feb 2011
    Posts
    14
    Does DosBox should support C.Anyways I will use pelles C.Could you still please tell me what the problem is?

  4. #4
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,676
    Not really, because the question is too vague. What do you mean by "running [our] C programs"? If it can't find stdio.h, it wont compile, so you can't run your program. Do you mean can't compile your program? If so, what is your compiler? Do you have the compiler/projects settings using the right include directories (check your manual/docs)? Does the compiler have read access to the header files? There are too many variables here for us to say what the problem is, beyond it's "unable to open include file "stdio.h", but you already know that.

  5. #5
    Registered User
    Join Date
    Feb 2011
    Posts
    14
    Code:
    #include<stdio.h>
    #include<conio.h>
    void main()
    {
    clrscr();
    getch();
    }
    PellesC gives error.Do I have to learn things all over again?

  6. #6
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,175
    Quote Originally Posted by livid View Post
    Code:
    #include<stdio.h>
    #include<conio.h>
    void main()
    {
    clrscr();
    getch();
    }
    PellesC gives error.Do I have to learn things all over again?
    What error?

    It seems to me like you just need to learn how to use DOSBOX.
    If you understand what you're doing, you're not learning anything.

  7. #7
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,676
    Quote Originally Posted by livid View Post
    Code:
    #include<stdio.h>
    #include<conio.h>
    void main()
    {
    clrscr();
    getch();
    }
    PellesC gives error.Do I have to learn things all over again?
    Find out where stdio.h is located in DOSBOX, and make sure that Pelles C knows where to find that. Unlike many *NIX systems, I don't think there's a standard location for header files that every compiler can just assume. It depends on the IDE/compiler. Once you find where stdio.h is located, check your Pelles C docs for how to specify include file locations.

  8. #8
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,676
    Oh yeah, and void main is a no-no.

  9. #9
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Pelles C has a *native* C compiler for Windows 7, including both 32 bit and 64 bit versions.

    So why are you using DOSBOX still, in Windows 7?

    Check it in the header files, but I don't believe conio.h is supported (it is not supported on most versions of C).

    And, as mentioned above, you have to know where DOSBOX is taking you, and let your compiler know where to look for it's files. That will be true with any compiler, no matter what.

  10. #10
    Registered User
    Join Date
    Feb 2011
    Posts
    14
    I thought I mentioned the fact that I used Pelles C.The code is not working in Pelles C not dosbox.

  11. #11
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Quote Originally Posted by Adak View Post
    So why are you using DOSBOX still, in Windows 7?
    To play X-COM, duh!


    Quzah.
    Hope is the first step on the road to disappointment.

  12. #12
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    @livid:
    I already answered this:
    Check it in the header files, but I don't believe conio.h is supported (it is not supported on most versions of C).
    @Quzah:
    Yeah, I have a fav DOS based game also. Hard on the wrists to play it, but the original Prince of Persia game (using just the single tinny PC speaker), is great.

    In one part, you have to drink from one of the potions before you. Drink the wrong one, and you die - of course. Drink the other wrong one, and the screen instantly changes to upside down and backwards.

    I defy anyone to run and leap through the gauntlet of troubles facing them, (and sword fighting, of course), all upside down and backwards. What a blast!

  13. #13
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by livid View Post
    I thought I mentioned the fact that I used Pelles C.The code is not working in Pelles C not dosbox.
    So... why even mention DOSBOX? All you're doing is confusing people.

    From the DOSBOX tutorial...
    DOSBox is an emulator that recreates a MS-DOS compatible environment (complete with Sound, Input, Graphics and even basic networking). This environment is complete enough to run many classic MS-DOS games completely unmodified.
    This is NOT a compiler and you should not be using it to run a compiler... it is an emulator that lets you run 8 bit DOS programs from the early 1980s. With anything more recent, you simply do not need it.

    It is totally unnecessary with programs written in Pelles C... you can simply open a console window in Win7 and run your programs... Type WIN+R then type CMD and click OK... instant console window.

    Pelles C does support conio as part of it's private headers collection. It's not part of C99.
    Unless you've been messing with your include paths and library paths it should work just fine.

    Do the following EXACTLY...
    Open Pelles C IDE
    Click the X in the project tree to close all projects
    Click on Tools in the menu
    Click on Options
    Click on Folders
    Click the Defaults button
    Close and re-open the IDE
    Now open your project...
    Click on Project in the menu
    Click on Project Options
    Click on Folders
    Click the Defaults button

    You should now be able to include conio.h without errors.

    While you're at it... READ THE HELP FILE... Pelle did an amazing job of documenting his compiler and libraries...

  14. #14
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,657
    I think the reason he wanted to use DOSBOX was because he was using that fossil Turbo C. Now he's trying to use Pelles C with Turbo C code and failing miserably, because his Turbo C code is using non-standard Borland libraries.

  15. #15
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by rags_to_riches View Post
    I think the reason he wanted to use DOSBOX was because he was using that fossil Turbo C. Now he's trying to use Pelles C with Turbo C code and failing miserably, because his Turbo C code is using non-standard Borland libraries.
    He should be able to move from turbo c to pelles pretty easily... Most of the same headers and libraries exist in both... The thing is he's going to have to use the 32 bit versions that come with PellesC and not the 16 bit versions that came with the dinosaur...

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling C in Visual Studio 2005
    By emanresu in forum C Programming
    Replies: 3
    Last Post: 11-16-2009, 04:25 AM
  2. Replies: 9
    Last Post: 02-13-2008, 02:59 PM
  3. How to program a "back" button with MFC
    By 99atlantic in forum Windows Programming
    Replies: 3
    Last Post: 04-26-2005, 09:34 PM
  4. New Theme
    By XSquared in forum A Brief History of Cprogramming.com
    Replies: 160
    Last Post: 04-01-2004, 08:00 PM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 10:44 AM

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