-4

I am using macOS.

this is a part of a code.

#include <stdio.h>
#include <stdlib.h>
#include <dos.h>
#include <time.h>

void firstPage();  
void instructions();       
void border();       
void patternOfGrass();
void patternOfPipes();
void birdFlies(int);
void birdFliesCont();
int  getkey();
int  gameOver();
void gotoxy(int, int);
void continueGame();
void youLose();


int length_of_pipes[80],speed=700,score=0,flag=0,level=1;

these are errors I get.

flappy.c:2:10: fatal error: 'conio.h' file not found
#include <conio.h>
         ^~~~~~~~~
1 error generated.
kam~ gcc flappy.c
flappy.c:3:10: fatal error: 'graphics.h' file not found
#include <graphics.h>

also it displays errors in dos.h and time.h too.

Kamol
  • 1
  • 1
  • 4
  • 2
    What OS and compiler are you using? – a_random_programmer May 18 '20 at 13:05
  • 4
    Please put your code and error messages directly in the question as text, not as external links or images. – Stephen Newell May 18 '20 at 13:06
  • 2
    `conio.h` is specific to older Microsoft implementations, and is not part of the standard library. If you're trying to compile old DOS code with gcc or something, it won't work. Please copy and paste the code you're trying to compile and the error message into the body of your question. – John Bode May 18 '20 at 13:11
  • Does this answer your question? [How to implement getch() function of C in Linux?](https://stackoverflow.com/questions/3276546/how-to-implement-getch-function-of-c-in-linux) – Kashinath Patekar May 18 '20 at 13:36

2 Answers2

1

Your errors indicate that your code is meant for DOS (maybe Windows)

You might try: https://stackoverflow.com/a/4371596/3937

Lou Franco
  • 87,846
  • 14
  • 132
  • 192
1
  • dos.h is, as the name hints, the MS DOS API provided by Borland for their Turbo C and Turbo C++ compilers. It contains everything you need for MS DOS programming.

    You need to compile with Turbo C on a MS DOS compatible computer for that code to run. Some Windows version like Win 95/98 still had MS DOS emulation.

  • conio.h is a console user interface API, supported at some extent by several other MS DOS compilers.

  • graphics.h is Borland's fancy EGA graphics library "Borland Graphics Interface". You need a fancy EGA graphics card to run it. And of course, a MS DOS computer with Borland Turbo C. A monitor that supports 16 colors is recommended.

So first you have to download Turbo C from The Borland Museum - Antique Software: Turbo C version 2.01.

After doing so, you need to contact technical museums and ask around if anyone have preserved an ancient computer that you could borrow. Or alternatively, you could spend weeks trying to get some "DOSBox" emulator working on your Mac. You might have to run the DOS emulator in a Windows emulator, I would assume.

Community
  • 1
  • 1
Lundin
  • 195,001
  • 40
  • 254
  • 396