Graphics interface question

Jul 10, 2017 at 4:53pm
Hi, I want to run graphics interface on C++ compiler run by Xcode on my mac, but get the error message: 'graphics.h' file not found. Same for 'conio.h'. Where's the problem?

Here are my code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <iostream>
#include <graphics.h>
#include <conio.h>

using namespace std;

int main()
{
    int i, j;
    cout << "Multiplikacijos lentelė" << endl;
    for(i=1; i<=10; i++)  {
        for (j=1; j<=10; j++) {
        cout << j*i << "\t";
        }
    line(100,100,200,100)
    cout << endl;
    }
}
Jul 10, 2017 at 5:26pm
conio.h and graphics.h are mainly for DOS/old Windows. They are not standard C++ headers. For similar functionality on Unix-like operating systems you might want to consider using the ncurses library instead.
Jul 10, 2017 at 5:36pm
Peter87 thank you very much! Can you also give me an example of how to use it, so I could draw successfully lines in my c++ program on mac? Thanks!
Last edited on Jul 10, 2017 at 6:02pm
Jul 11, 2017 at 10:04am
I might have been wrong about graphics.h. I don't even know if the mac os terminal are able to output graphics on per-pixel level. ncurses is more like conio in that it is concerned about characters, not individual pixels. If you want to output real graphics it might be better to go for a full fledged multimedia library such as SDL or SFML.
Last edited on Jul 11, 2017 at 10:04am
Topic archived. No new replies allowed.