Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/56.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C 从Visual Studio 2013切换回2012时出现Intellisense错误_C_Opengl_Visual Studio 2012_Intellisense - Fatal编程技术网

C 从Visual Studio 2013切换回2012时出现Intellisense错误

C 从Visual Studio 2013切换回2012时出现Intellisense错误,c,opengl,visual-studio-2012,intellisense,C,Opengl,Visual Studio 2012,Intellisense,我有一个OpenGL应用程序,在使用Visual Studio 2013时运行时没有任何错误。现在,我的VS2013许可证已过期,我切换回VS2012。当我在VS2012中打开该项目时,会出现大量错误: 41 IntelliSense: expected a ')' c:\Users\Halil\Desktop\comp410_hw1\comp410_hw1\main.cpp 96 64 comp410_hw1 42 IntelliSense: expected a

我有一个OpenGL应用程序,在使用Visual Studio 2013时运行时没有任何错误。现在,我的VS2013许可证已过期,我切换回VS2012。当我在VS2012中打开该项目时,会出现大量错误:

    41  IntelliSense: expected a ')'    c:\Users\Halil\Desktop\comp410_hw1\comp410_hw1\main.cpp 96  64  comp410_hw1
    42  IntelliSense: expected a ')'    c:\Users\Halil\Desktop\comp410_hw1\comp410_hw1\main.cpp 100 63  comp410_hw1
    43  IntelliSense: expected a ')'    c:\Users\Halil\Desktop\comp410_hw1\comp410_hw1\main.cpp 104 63  comp410_hw1
    44  IntelliSense: expected a ')'    c:\Users\Halil\Desktop\comp410_hw1\comp410_hw1\main.cpp 108 63  comp410_hw1
    45  IntelliSense: expected a ')'    c:\Users\Halil\Desktop\comp410_hw1\comp410_hw1\main.cpp 112 63  comp410_hw1
    46  IntelliSense: expected a ')'    c:\Users\Halil\Desktop\comp410_hw1\comp410_hw1\main.cpp 116 63  comp410_hw1
    47  IntelliSense: expected a ')'    c:\Users\Halil\Desktop\comp410_hw1\comp410_hw1\main.cpp 120 63  comp410_hw1
    48  IntelliSense: expected a ')'    c:\Users\Halil\Desktop\comp410_hw1\comp410_hw1\main.cpp 124 63  comp410_hw1
Error   5   error C2181: illegal else without matching if   c:\users\halil\desktop\comp410_hw1\comp410_hw1\main.cpp 97  1   comp410_hw1
Error   10  error C2181: illegal else without matching if   c:\users\halil\desktop\comp410_hw1\comp410_hw1\main.cpp 101 1   comp410_hw1
Error   15  error C2181: illegal else without matching if   c:\users\halil\desktop\comp410_hw1\comp410_hw1\main.cpp 105 1   comp410_hw1
Error   20  error C2181: illegal else without matching if   c:\users\halil\desktop\comp410_hw1\comp410_hw1\main.cpp 109 1   comp410_hw1
Error   25  error C2181: illegal else without matching if   c:\users\halil\desktop\comp410_hw1\comp410_hw1\main.cpp 113 1   comp410_hw1
Error   30  error C2181: illegal else without matching if   c:\users\halil\desktop\comp410_hw1\comp410_hw1\main.cpp 117 1   comp410_hw1
Error   35  error C2181: illegal else without matching if   c:\users\halil\desktop\comp410_hw1\comp410_hw1\main.cpp 121 1   comp410_hw1
Error   40  error C2181: illegal else without matching if   c:\users\halil\desktop\comp410_hw1\comp410_hw1\main.cpp 125 1   comp410_hw1
Error   4   error C2143: syntax error : missing ';' before '}'  c:\users\halil\desktop\comp410_hw1\comp410_hw1\main.cpp 96  1   comp410_hw1
Error   8   error C2143: syntax error : missing ';' before '}'  c:\users\halil\desktop\comp410_hw1\comp410_hw1\main.cpp 100 1   comp410_hw1
Error   13  error C2143: syntax error : missing ';' before '}'  c:\users\halil\desktop\comp410_hw1\comp410_hw1\main.cpp 104 1   comp410_hw1
Error   18  error C2143: syntax error : missing ';' before '}'  c:\users\halil\desktop\comp410_hw1\comp410_hw1\main.cpp 108 1   comp410_hw1
Error   23  error C2143: syntax error : missing ';' before '}'  c:\users\halil\desktop\comp410_hw1\comp410_hw1\main.cpp 112 1   comp410_hw1
Error   28  error C2143: syntax error : missing ';' before '}'  c:\users\halil\desktop\comp410_hw1\comp410_hw1\main.cpp 116 1   comp410_hw1
Error   33  error C2143: syntax error : missing ';' before '}'  c:\users\halil\desktop\comp410_hw1\comp410_hw1\main.cpp 120 1   comp410_hw1
Error   38  error C2143: syntax error : missing ';' before '}'  c:\users\halil\desktop\comp410_hw1\comp410_hw1\main.cpp 124 1   comp410_hw1
Error   3   error C2143: syntax error : missing ';' before '{'  c:\users\halil\desktop\comp410_hw1\comp410_hw1\main.cpp 96  1   comp410_hw1
Error   7   error C2143: syntax error : missing ';' before '{'  c:\users\halil\desktop\comp410_hw1\comp410_hw1\main.cpp 100 1   comp410_hw1
Error   12  error C2143: syntax error : missing ';' before '{'  c:\users\halil\desktop\comp410_hw1\comp410_hw1\main.cpp 104 1   comp410_hw1
Error   17  error C2143: syntax error : missing ';' before '{'  c:\users\halil\desktop\comp410_hw1\comp410_hw1\main.cpp 108 1   comp410_hw1
Error   22  error C2143: syntax error : missing ';' before '{'  c:\users\halil\desktop\comp410_hw1\comp410_hw1\main.cpp 112 1   comp410_hw1
Error   27  error C2143: syntax error : missing ';' before '{'  c:\users\halil\desktop\comp410_hw1\comp410_hw1\main.cpp 116 1   comp410_hw1
Error   32  error C2143: syntax error : missing ';' before '{'  c:\users\halil\desktop\comp410_hw1\comp410_hw1\main.cpp 120 1   comp410_hw1
Error   37  error C2143: syntax error : missing ';' before '{'  c:\users\halil\desktop\comp410_hw1\comp410_hw1\main.cpp 124 1   comp410_hw1
Error   1   error C2143: syntax error : missing ')' before '{'  c:\users\halil\desktop\comp410_hw1\comp410_hw1\main.cpp 96  1   comp410_hw1
Error   6   error C2143: syntax error : missing ')' before '{'  c:\users\halil\desktop\comp410_hw1\comp410_hw1\main.cpp 100 1   comp410_hw1
Error   11  error C2143: syntax error : missing ')' before '{'  c:\users\halil\desktop\comp410_hw1\comp410_hw1\main.cpp 104 1   comp410_hw1
Error   16  error C2143: syntax error : missing ')' before '{'  c:\users\halil\desktop\comp410_hw1\comp410_hw1\main.cpp 108 1   comp410_hw1
Error   21  error C2143: syntax error : missing ')' before '{'  c:\users\halil\desktop\comp410_hw1\comp410_hw1\main.cpp 112 1   comp410_hw1
Error   26  error C2143: syntax error : missing ')' before '{'  c:\users\halil\desktop\comp410_hw1\comp410_hw1\main.cpp 116 1   comp410_hw1
Error   31  error C2143: syntax error : missing ')' before '{'  c:\users\halil\desktop\comp410_hw1\comp410_hw1\main.cpp 120 1   comp410_hw1
Error   36  error C2143: syntax error : missing ')' before '{'  c:\users\halil\desktop\comp410_hw1\comp410_hw1\main.cpp 124 1   comp410_hw1
Error   2   error C2059: syntax error : ')' c:\users\halil\desktop\comp410_hw1\comp410_hw1\main.cpp 96  1   comp410_hw1
Error   9   error C2059: syntax error : ')' c:\users\halil\desktop\comp410_hw1\comp410_hw1\main.cpp 100 1   comp410_hw1
Error   14  error C2059: syntax error : ')' c:\users\halil\desktop\comp410_hw1\comp410_hw1\main.cpp 104 1   comp410_hw1
Error   19  error C2059: syntax error : ')' c:\users\halil\desktop\comp410_hw1\comp410_hw1\main.cpp 108 1   comp410_hw1
Error   24  error C2059: syntax error : ')' c:\users\halil\desktop\comp410_hw1\comp410_hw1\main.cpp 112 1   comp410_hw1
Error   29  error C2059: syntax error : ')' c:\users\halil\desktop\comp410_hw1\comp410_hw1\main.cpp 116 1   comp410_hw1
Error   34  error C2059: syntax error : ')' c:\users\halil\desktop\comp410_hw1\comp410_hw1\main.cpp 120 1   comp410_hw1
Error   39  error C2059: syntax error : ')' c:\users\halil\desktop\comp410_hw1\comp410_hw1\main.cpp 124 1   comp410_hw1
所有这些错误都属于这段代码:

void setColor()
{
    switch (currentColor)
    {
    case COLOR_RED:
        if (lightOn) {glLightfv(GL_LIGHT0, GL_DIFFUSE, new GLfloat[] { 1.0, 0.0, 0.0, 1.0});}
        else glColor3f(1.0, 0.0, 0.0);
        break;
    case COLOR_GREEN:
        if (lightOn) glLightfv(GL_LIGHT0, GL_DIFFUSE, new GLfloat[] { 0.0, 1.0, 0.0, 1.0});
        else glColor3f(0.0, 1.0, 0.0);
        break;
    case COLOR_BLUE:
        if (lightOn) glLightfv(GL_LIGHT0, GL_DIFFUSE, new GLfloat[] { 0.0, 0.0, 1.0, 1.0});
        else glColor3f(0.0, 0.0, 1.0);
        break;
    case COLOR_CYAN:
        if (lightOn) glLightfv(GL_LIGHT0, GL_DIFFUSE, new GLfloat[] { 0.0, 1.0, 1.0, 1.0});
        else glColor3f(0.0, 1.0, 1.0);
        break;
    case COLOR_MAGENTA:
        if (lightOn) glLightfv(GL_LIGHT0, GL_DIFFUSE, new GLfloat[] { 1.0, 0.0, 1.0, 1.0});
        else glColor3f(1.0, 0.0, 1.0);
        break;
    case COLOR_YELLOW:
        if (lightOn) glLightfv(GL_LIGHT0, GL_DIFFUSE, new GLfloat[] { 1.0, 1.0, 0.0, 1.0});
        else glColor3f(1.0, 1.0, 0.0);
        break;
    case COLOR_PURPLE:
        if (lightOn) glLightfv(GL_LIGHT0, GL_DIFFUSE, new GLfloat[] { 0.5, 0.0, 0.5, 1.0});
        else glColor3f(0.5, 0.0, 0.5);
        break;
    case COLOR_ORANGE:
        if (lightOn) glLightfv(GL_LIGHT0, GL_DIFFUSE, new GLfloat[] { 1.0, 0.5, 0.0, 1.0});
        else glColor3f(1.0, 0.5, 0.0);
        break;
    }
}

我首先想到的是头文件弄得一团糟,所以我把它们按各种可能的顺序排列,但这些愚蠢的错误仍然存在。

Intelissense在项目文件*.sdf中保存了一些信息,请尝试将其删除,然后重新打开并重新编译项目。不,不幸的是,它没有工作。当我删除.SDF文件并清理项目时,我仍然会遇到同样的错误。注意到,您使用的是C++,莱特?这样的构造:新的GLfloat[]{0.5,0.0,0.5,1.0}是非法的。通常创建这些数组,作为静态大小数组,初始化列表GLfloata[]={0.5f,0.0f,0.5f,1.0f};glLightfvGL_LIGHT0,GL_漫反射,a;,或者动态地,然后,用值填充它们。这实际上是我的一个朋友建议的,这是有道理的,这是非法的。然而,当我在VS2013上运行这个项目时,它并没有引起问题。是因为他们使用的编译器不同吗?这会改变语言的可接受语法吗?我按照你告诉我的方式改变了代码,现在一切正常。非常感谢。但我仍然对这种行为感到困惑。如果你知道是什么原因,请告诉我。