1

I had written a code in turbo C++ compiler and now i have moved on to visual studio express 2012 for windows desktop I get many errors which did not come in turbo C++ The errors are

1   IntelliSense: identifier "textcolor" is undefined   c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  75  1   Project2
2   IntelliSense: identifier "RED" is undefined c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  75  11  Project2
3   IntelliSense: identifier "textbackground" is undefined  c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  76  1   Project2
4   IntelliSense: identifier "BLACK" is undefined   c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  76  16  Project2
5   IntelliSense: identifier "clrscr" is undefined  c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  77  1   Project2
6   IntelliSense: identifier "gotoxy" is undefined  c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  83  2   Project2
7   IntelliSense: identifier "sleep" is undefined   c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  118 4   Project2
8   IntelliSense: identifier "sleep" is undefined   c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  121 3   Project2
9   IntelliSense: identifier "WHITE" is undefined   c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  126 12  Project2
10  IntelliSense: identifier "BLUE" is undefined    c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  127 17  Project2
11  IntelliSense: identifier "clrscr" is undefined  c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  209 3   Project2
12  IntelliSense: identifier "sleep" is undefined   c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  211 3   Project2
13  IntelliSense: identifier "clrscr" is undefined  c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  214 2   Project2
14  IntelliSense: identifier "sleep" is undefined   c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  249 3   Project2
15  IntelliSense: identifier "sleep" is undefined   c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  264 3   Project2
16  IntelliSense: identifier "clrscr" is undefined  c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  288 1   Project2
17  IntelliSense: identifier "clrscr" is undefined  c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  313 5   Project2
18  IntelliSense: identifier "textcolor" is undefined   c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  314 5   Project2
19  IntelliSense: identifier "RED" is undefined c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  314 15  Project2
20  IntelliSense: identifier "sleep" is undefined   c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  316 5   Project2
21  IntelliSense: identifier "WHITE" is undefined   c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  317 15  Project2
22  IntelliSense: identifier "BLACK" is undefined   c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  320 15  Project2
23  IntelliSense: identifier "clrscr" is undefined  c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  327 5   Project2
24  IntelliSense: identifier "textcolor" is undefined   c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  328 5   Project2
25  IntelliSense: identifier "WHITE" is undefined   c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  348 15  Project2
26  IntelliSense: identifier "clrscr" is undefined  c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  365 3   Project2
27  IntelliSense: identifier "sleep" is undefined   c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  367 3   Project2
28  IntelliSense: identifier "clrscr" is undefined  c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  371 2   Project2
29  IntelliSense: identifier "textcolor" is undefined   c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  390 5   Project2
30  IntelliSense: identifier "textcolor" is undefined   c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  442 5   Project2
31  IntelliSense: identifier "clrscr" is undefined  c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  491 3   Project2
32  IntelliSense: identifier "gotoxy" is undefined  c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  492 3   Project2
33  IntelliSense: identifier "clrscr" is undefined  c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  498 2   Project2
34  IntelliSense: identifier "textcolor" is undefined   c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  508 4   Project2
35  IntelliSense: identifier "GREEN" is undefined   c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  510 14  Project2
36  IntelliSense: identifier "gotoxy" is undefined  c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  514 5   Project2
37  IntelliSense: identifier "WHITE" is undefined   c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  526 14  Project2
38  IntelliSense: identifier "gotoxy" is undefined  c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  540 5   Project2
39  IntelliSense: identifier "gotoxy" is undefined  c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  566 5   Project2
40  IntelliSense: identifier "clrscr" is undefined  c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  595 1   Project2
41  IntelliSense: identifier "clrscr" is undefined  c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  600 1   Project2
42  IntelliSense: identifier "sleep" is undefined   c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  624 3   Project2
43  IntelliSense: identifier "clrscr" is undefined  c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  627 5   Project2
44  IntelliSense: incomplete type is not allowed    c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  711 17  Project2
45  IntelliSense: identifier "sleep" is undefined   c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  727 3   Project2
46  IntelliSense: identifier "getdate" is undefined c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  732 5   Project2
47  IntelliSense: identifier "clrscr" is undefined  c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  734 2   Project2
48  IntelliSense: identifier "textcolor" is undefined   c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  735 5   Project2
49  IntelliSense: incomplete type is not allowed    c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  740 40  Project2
50  IntelliSense: incomplete type is not allowed    c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  740 49  Project2
51  IntelliSense: incomplete type is not allowed    c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  740 58  Project2
52  IntelliSense: identifier "gotoxy" is undefined  c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  1030    2   Project2
53  IntelliSense: identifier "clrscr" is undefined  c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  1087    4   Project2
54  IntelliSense: identifier "sleep" is undefined   c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  1089    4   Project2
55  IntelliSense: identifier "clrscr" is undefined  c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  1092    2   Project2
56  IntelliSense: identifier "textcolor" is undefined   c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  1104    5   Project2
57  IntelliSense: identifier "gotoxy" is undefined  c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  1105    5   Project2
58  IntelliSense: identifier "WHITE" is undefined   c:\Users\Windows 8 Java\Documents\Visual Studio 2012\Projects\Project2\Project2\main.c  1139    17  Project2

I have figured out that it doesnt allow me to use clrscr, sleep, textcolor, textbackground, gotoxy and it even doesnt understand color names All this used to work in turbo C++ I couldnt figure out a way to do this in visual studio. Maybe i am missing some setting because, to even create a c project i had to do a lot of things, I had created a c project according to this: http://www.youtube.com/watch?v=bjHD1N7tjV4 and then pasted my code

1 Answers1

2

Visual studio does not support borland functions clrscr(),gotoxy() and etc.. for this

you need either special library

Example---> Public Domain Curses(PDCurses)

or else you need to find some alternative

some example

clrscr() ==> system("cls")

or

Either you can define your own functions with Windows Console Functions

Example definition for gotoxy()

void gotoxy(int x, int y)
{
    COORD pos = { x, y };

    SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
}
Gangadhar
  • 10,248
  • 3
  • 31
  • 50
  • 1
    Can you please provide me with the codes of other functions which are not working, too like one to change text/background color Please see the errors from my question THANKS –  Oct 01 '13 at 04:44
  • 1
    Use Library rather than defining all or try to use console functions to define your own functions.And do search for each function that you need. – Gangadhar Oct 01 '13 at 05:27
  • 1
    And library? where would i find the name of the library and how do i insert it Please don't be angry and explain it please please clearly. This is a 14 year old boy and a newbie to gcc THANKS –  Oct 01 '13 at 05:31
  • 1
    see [Here](http://stackoverflow.com/questions/9203362/c-color-text-in-terminal-applications-in-windows) And [Here](http://msdn.microsoft.com/en-us/library/windows/desktop/ms682088%28v=vs.85%29.aspx#_win32_character_attributes). You can find how to use `SetConsoleTextAttribute()` – Gangadhar Oct 01 '13 at 05:45
  • 1
    Sir i went to PDCurses they had downloads but i dont noe how to include those in visual studio and i want to do that in DEV C++ even –  Oct 01 '13 at 05:46
  • you might feel some difficulty in using library. you just need four to five functions. forgot about library here. Gothrough with the links given in above comment – Gangadhar Oct 01 '13 at 05:48
  • I went on to http://msdn.microsoft.com/en-us/library/ms682073%28VS.85%29.aspx too but i find it very difficult and i cant understand what to do. Please help. –  Oct 01 '13 at 05:55
  • see first link my second comment – Gangadhar Oct 01 '13 at 06:25
  • Please give it again, i cant find it –  Oct 01 '13 at 07:30
  • http://stackoverflow.com/questions/9203362/c-color-text-in-terminal-applications-in-windows – Gangadhar Oct 01 '13 at 10:20