qua*_*231 1 c++ visual-c++ visual-studio-2013
这是我的程序,因为它最少重现错误:
#include <iostream>
#include <Windows.h>
#include <fstream>
using namespace std;
#define iwidth 5;
#define iheight 3;
int main()
{
struct rgb_data_struct {
BYTE B;
BYTE G;
BYTE R;
};
rgb_data_struct **image;
image = new rgb_data_struct *[iwidth];
for (int i = 0; i < iwdith; i++)
{
}
return 0;
}
Run Code Online (Sandbox Code Playgroud)
现在的问题是,我在主函数中使用iwdith,它用红色曲折线加下划线.将鼠标悬停在"错误:预期a']'"上
编译会产生以下错误:
Error 1 error C2143: syntax error : missing ')' before ';' c:\users\user0\documents\cpp\bitmap\bitmap\main.cpp 51 1 bitmap
Error 2 error C2143: syntax error : missing ']' before ')' c:\users\user0\documents\cpp\bitmap\bitmap\main.cpp 51 1 bitmap
Error 3 error C2143: syntax error : missing ';' before ')' c:\users\user0\documents\cpp\bitmap\bitmap\main.cpp 51 1 bitmap
Error 4 error C2143: syntax error : missing ';' before ']' c:\users\user0\documents\cpp\bitmap\bitmap\main.cpp 51 1 bitmap
Error 5 error C2065: 'iwdith' : undeclared identifier c:\users\user0\documents\cpp\bitmap\bitmap\main.cpp 52 1 bitmap
6 IntelliSense: expected a ']' c:\Users\user0\Documents\Cpp\bitmap\bitmap\main.cpp 51 32 bitmap
7 IntelliSense: expected an expression c:\Users\user0\Documents\Cpp\bitmap\bitmap\main.cpp 51 38 bitmap
8 IntelliSense: identifier "iwdith" is undefined c:\Users\user0\Documents\Cpp\bitmap\bitmap\main.cpp 52 22 bitmap
Run Code Online (Sandbox Code Playgroud)
我正在使用Microsoft Visual Studio社区2013.我不明白为什么当我声明它时IDE没有看到iwidth!