Problem with conio.h

Hello,

To start with, I am using Windows 7, QT Creator and MinGW as a compiler. I am having problems with the conio.h header. Every time I inculde the conio.h header, and try to run a program QT responds that my conio specific commands (for example, clrscr or gotox) are not declared in ´this´ scope. To be exact it says "clrscr was not declared in this scope".
I am sure that MinGW supports conio.h since I can find C:\Qt\Qt5.1.0\Tools\mingw48_32\i686-w64-mingw32\include\conio. Im pretty sure the problem isn´t my code since if I try to run any example programs on this site http://cppprojectsolve.blogspot.be/2010/09/si-no_05.html, the same issue occurs. As a small example I just added #include <conio.h> and clrscr(); to the hello world program. I am a complete noob to C++ and programming as a whole.



1
2
3
4
5
6
7
8
9
10
11
#include <iostream>
#include <conio.h>
using namespace std;

int main()
{
    cout << "Hello World!" << endl;
    return 0;
    clrscr();

}


This program results in QT saying "clrscr was not declared in this scope". Does anyone know how i can get my conio command to work? :( I would be so greatfull.
conio.h is not standard. what comes with mingw may not contain clrscr();

By the way: it makes no sense to call clrscr(); after return 0;
Quote:
I can find C:\Qt\Qt5.1.0\Tools\mingw48_32\i686-w64-mingw32\include\conio.h

Did you open that file and search for clrscr in the code?
Chances are, you won't find it. That's because conio.h is non-standard, some compilers don't support it at all, and of those that do, the functions available may not be the same.

Best advice is to avoid the use of conio.h for these reasons.
Last edited on
Topic archived. No new replies allowed.