1

我在 turbo C++ 编译器中编写了一个代码,现在我已经转到 Visual Studio Express 2012 for Windows Desktop 我得到了许多在 turbo C++ 中没有出现的错误错误是

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

我发现它不允许我使用 clrscr、sleep、textcolor、textbackground、gotoxy,它甚至不理解颜色名称所有这些过去都可以在 turbo C++ 中工作,我无法在 Visual Studio 中找到一种方法。也许我错过了一些设置,因为即使要创建 ac 项目,我也必须做很多事情,我已经根据以下内容创建了 ac 项目:http ://www.youtube.com/watch?v= bjHD1N7tjV4 然后粘贴了我的代码

4

1 回答 1

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);
}
于 2013-10-01T04:34:15.787 回答