C ++编译器错误c4430“c ++不支持默认int” [英] C++ compiler error c4430 "c++ doesnt support default int"
本文介绍了C ++编译器错误c4430“c ++不支持默认int”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好我试图定义一个名为USHORT的别名。
Hi im trying to define an alias called 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 ++不支持default-int c:\ usersrs \ nanqvi-home \documents\justit\c ++ \w1 \cp1 \ list0304.cpp 8 1 ConsoleApplication3
Error 1 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\users\naqvi-home\documents\justit\c++\w1\cp1\list0304.cpp 8 1 ConsoleApplication3
谢谢
Ray
推荐答案
它与您的 typedef
无关。问题是你还没有给出 main
的退货类型:
It has nothing to do with your typedef
. The problem is that you haven't given a return type for main
:
int main()
{
// ...
}
函数必须具有返回类型。 main
函数必须返回 int
。
A function must have a return type. The main
function must return int
.
这篇关于C ++编译器错误c4430“c ++不支持默认int”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文