daniel_g
06-15-2007, 01:04 AM
I'm trying to add color to some text in my application, but I'm getting a nasty error:
#include <windows.h>
#include <iostream>
#include <cstdlib>
#include <conio.h>
#include <stdio.h>
#include <sstream>
using namespace std;
main(){
textcolor (YELLOW);
textbackground (BLUE);
cprintf ("Im yellow text on a nice blue background!");
}
error:
11 C:\Documents and Settings\Boris\Desktop\ruleta zero\test.cpp `YELLOW' undeclared (first use this function)
11 C:\Documents and Settings\Boris\Desktop\ruleta zero\test.cpp `textcolor' undeclared (first use this function)
12 C:\Documents and Settings\Boris\Desktop\ruleta zero\test.cpp `BLUE' undeclared (first use this function)
12 C:\Documents and Settings\Boris\Desktop\ruleta zero\test.cpp `textbackground' undeclared (first use this function)
13 C:\Documents and Settings\Boris\Desktop\ruleta zero\test.cpp `cprintf' undeclared (first use this function)
Of course, I don't know what I'm doing. I just got the function from somewhere on the net, and it said the conio.h header should be used. Any ideas?
I'm using Dev-C++
EDIT: Never Mind, the problem is that conio.h is very limited in Dev-C++. Solution is to get a Borland C++ compiler.
#include <windows.h>
#include <iostream>
#include <cstdlib>
#include <conio.h>
#include <stdio.h>
#include <sstream>
using namespace std;
main(){
textcolor (YELLOW);
textbackground (BLUE);
cprintf ("Im yellow text on a nice blue background!");
}
error:
11 C:\Documents and Settings\Boris\Desktop\ruleta zero\test.cpp `YELLOW' undeclared (first use this function)
11 C:\Documents and Settings\Boris\Desktop\ruleta zero\test.cpp `textcolor' undeclared (first use this function)
12 C:\Documents and Settings\Boris\Desktop\ruleta zero\test.cpp `BLUE' undeclared (first use this function)
12 C:\Documents and Settings\Boris\Desktop\ruleta zero\test.cpp `textbackground' undeclared (first use this function)
13 C:\Documents and Settings\Boris\Desktop\ruleta zero\test.cpp `cprintf' undeclared (first use this function)
Of course, I don't know what I'm doing. I just got the function from somewhere on the net, and it said the conio.h header should be used. Any ideas?
I'm using Dev-C++
EDIT: Never Mind, the problem is that conio.h is very limited in Dev-C++. Solution is to get a Borland C++ compiler.