【发布时间】:2013-03-03 13:57:24
【问题描述】:
您好,我正在尝试定义一个名为 USHORT 的别名。
// Demonstrates typedef keyword
#include <iostream>
typedef unsigned short int USHORT; // typedef defined
main() {
USHORT Width = 5;
USHORT Length;
Length = 10;
USHORT Area = Width * Length;
std::cout << "Width:" << Width << "\n";
std::cout << "Length: " << Length << std::endl;
std::cout << "Area: " << Area;
}
我不断收到编译器错误提示:
错误 1 错误 C4430:缺少类型说明符 - 假定为 int。注意:C++ 不支持 默认-int c:\users\naqvi-home\documents\justit\c++\w1\cp1\list0304.cpp 8 1 ConsoleApplication3
谢谢
【问题讨论】:
-
错误在哪一行????
-
它说错误在第 8 行,或者在第 8 行附近。使用 Visual Studios 2013 Express
-
注意:大多数编译器都指出错误消息的来源,编译器在您的示例中指向哪里?