Error_68_error C4430: missing type specifier - int assumed. Note: C++ does not support default-int_C

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hello everyone.
Im getting trouble with this error
Error<span style="white-space:pre 68<span style="white-space:pre
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int<span style="white-space:pre
C:Program Files (x86)Microsoft SDKsWindowsv7.0Aincludedlgs.h
That error occurs in dlgs.h file, but I have no idea about this, because this is the first time I get this error.

Here are my source code:

<div style="color:Black;background-color:White; <pre>
<span style="color:Green; // QLTV_LTHDT.cpp : main project file.

#include <span style="color:#A31515; "stdafx.h"
#include <span style="color:#A31515; "SinhVien.h"
#include <span style="color:#A31515; "Sach.h"
#include <span style="color:#A31515; "QLSach.h"
#include <span style="color:#A31515; "NgayThang.h"
#include <conio.h>

<span style="color:Blue; using <span style="color:Blue; namespace System;

<span style="color:Blue; int main(<span style="color:Blue; array<System::String ^> ^args)
{

QLSach a;
<span style="color:Green; /*a.ThemDSSV();
a.XuatDSSV();
*/
<span style="color:Green; //NgayThang a;

getch();
<span style="color:Blue; return 0;
}


[/code]

My header files include:
<span style="white-space:pre NgayThang.h (I use this class as date)
<span style="white-space:pre QLSach.h (Book management)
<span style="white-space:pre SinhVien.h (Student)
<span style="white-space:pre Sach.h (Book)
NgayThang.h:

<div style="color:Black;background-color:White; <pre>
#pragma once
#include <iostream>


<span style="color:Blue; using <span style="color:Blue; namespace std;
<span style="color:Blue; class NgayThang
{
<span style="color:Blue; protected:
<span style="color:Blue; int Ngay, Thang, Nam;
<span style="color:Blue; public:
NgayThang()
{
Ngay = 0;
Thang = 0;
Nam = 0;
}
<span style="color:Green; /*int GetNgay();
int GetThang();
int GetNam();*/
<span style="color:Blue; void Nhap();
<span style="color:Blue; void Xuat();
<span style="color:Green; /*friend ostream &operator<<(ostream &output, const NgayThang &ngaythang);
friend istream &operator>>(istream &input, NgayThang &ngaythang);*/

<span style="color:Blue; void NgayThang::Nhap()
{
cout<<<span style="color:#A31515; "Nhap Ngay: ";
cin>>Ngay;
cout<<<span style="color:#A31515; "Nhap Thang: ";
cin>>Thang;
cout<<<span style="color:#A31515; "Nhap Nam: ";
cin>>Nam;
}

<span style="color:Blue; void NgayThang::Xuat()
{
cout<<Ngay<<<span style="color:#A31515; "/"<<Thang<<<span style="color:#A31515; "/"<<Nam;
}

<span style="color:Green; //ostream &operator<<(ostream &output, const NgayThang &ngaythang)
<span style="color:Green; //{
<span style="color:Green; // return output<<ngaythang.Ngay<<"/"<<ngaythang.Thang<<"/"<<ngaythang.Nam;
<span style="color:Green; //}

<span style="color:Green; //istream &operator>>(istream &input, NgayThang &ngaythang)
<span style="color:Green; //{
<span style="color:Green; // cout<<"Nhap Ngay: ";
<span style="color:Green; // input>>ngaythang.Ngay;
<span style="color:Green; // cout<<"Nhap Thang: ";
<span style="color:Green; // input>>ngaythang.Thang;
<span style="color:Green; // cout<<"Nhap Nam: ";
<span style="color:Green; // input>>ngaythang.Nam;
<span style="color:Green; //
<span style="color:Green; // return input;
<span style="color:Green; //}
<span style="color:Green; //int NgayThang::GetNgay()
<span style="color:Green; //{
<span style="color:Green; // return Ngay;
<span style="color:Green; //}
<span style="color:Green; //
<span style="color:Green; //int NgayThang::GetThang()
<span style="color:Green; //{
<span style="color:Green; // return Thang;
<span style="color:Green; //}
<span style="color:Green; //
<span style="color:Green; //int NgayThang::GetNam()
<span style="color:Green; //{
<span style="color:Green; // return Nam;
<span style="color:Green; //}
[/code]
<br/>

QLSach.h

<div style="color:Black;background-color:White; <pre>
#pragma once
#include <span style="color:#A31515; "NgayThang.h"
#include <ctime>
#include <Windows.h>
#include <string.h>

<span style="color:Blue; class QLSach : <span style="color:Blue; protected SinhVien, <span style="color:Blue; public Sach
{
<span style="color:Blue; private:
SinhVien *ds;
<span style="color:Blue; int SoLuongSV;
Sach *dssach;
<span style="color:Blue; int SoLuongSach;
NgayThang NgayMuon, NgayTra;
<span style="color:Blue; public:
QLSach() : SinhVien(), Sach()
{
time_t now = time(0);
cout << asctime(localtime(&now));
<span style="color:Green; //ds = new SinhVien[SoLuongSV];

}

<span style="color:Blue; void ThemDSSV();
<span style="color:Blue; void ThemDSSach();
<span style="color:Blue; void XuatDSSV();
<span style="color:Blue; void XuatDSSach();
<span style="color:Blue; void MuonSach(SinhVien a, Sach b);
};

<span style="color:Blue; void QLSach::ThemDSSV()
{
FILE *taptin;
taptin = fopen(<span style="color:#A31515; "E:\DSSV.dat", <span style="color:#A31515; "ab");
SinhVien sv;
cout<<<span style="color:#A31515; "Nhap so luong SV can luu thong tin: ";
cin>>SoLuongSV;
ds = <span style="color:Blue; new SinhVien[SoLuongSV];
<span style="color:Blue; for(<span style="color:Blue; int i=0; i<SoLuongSV; ++i)
{

system(<span style="color:#A31515; "cls");
cout<<<span style="color:#A31515; "Sinh vien thu "<<i+1<<endl;
ds = sv.NhapSV();
cout<<endl;
fwrite(&ds, <span style="color:Blue; sizeof(SinhVien), 1, taptin);
}
fclose(taptin);
}

<span style="color:Blue; void QLSach::XuatDSSV()
{
FILE *taptin;
fflush(taptin);
taptin = fopen(<span style="color:#A31515; "E:\DSSV.dat", <span style="color:#A31515; "rb");
<span style="color:Blue; int i = 0;
SinhVien sv;
system(<span style="color:#A31515; "cls");
<span style="color:Blue; if(!feof(taptin))
{
cout<<<span style="color:#A31515; "Doc file bi loi";
}
<span style="color:Blue; else
{
<span style="color:Blue; for(<span style="color:Blue; int i=0; i<SoLuongSV; i++)
{
fread(&ds, <span style="color:Blue; sizeof(SinhVien), 1, taptin);
sv = ds;
sv.XuatSV(sv);
}
}
fclose(taptin);
}

<span style="color:Blue; void QLSach::ThemDSSach()
{
Sach sach;
cout<<<span style="color:#A31515; "Nhap so luong sach can luu thong tin: ";
cin>>SoLuongSach;
dssach = <span style="color:Blue; new Sach[SoLuongSach];
<span style="color:Blue; for(<span style="color:Blue; int i=0; i<SoLuongSach; i++)
{
system(<span style="color:#A31515; "cls");
cout<<<span style="color:#A31515; "Sach thu "<<i+1<<endl;
dssach = sach.NhapSach();
cout<<endl;
}
}

<span style="color:Blue; void QLSach::XuatDSSach()
{
Sach sach;
system(<span style="color:#A31515; "cls");
<span style="color:Blue; for(<span style="color:Blue; int i=0; i<SoLuongSach; i++)
{
sach = dssach;
sach.XuatSach(sach);
}
}

<span style="color:Blue; void QLSach::MuonSach(SinhVien a, Sach b)
{
<span style="color:Green; //cout<<"Nhap MS cua SV muon sach: ";
<span style="color:Green; //a.MSSV = (char*)malloc(sizeof(char)); //phải viết thêm hàm GetMSSV() trong class SinhVien
<span style="color:Green; //fflush(stdin);
<span style="color:Green; //gets(a.MSSV);
<span style="color:Green; //cout<<"Nhap so luong sach can muon: ";


}
[/code]

SinhVien.h

<div style="color:Black;background-color:White; <pre>
#pragma once
#include <iostream>
#include <string.h>
#include <span style="color:#A31515; "NgayThang.h"

<span style="color:Blue; using <span style="color:Blue; namespace std;

<span style="color:Blue; class SinhVien
{

<span style="color:Blue; protected:
<span style="color:Blue; char *MSSV, *HoTen, *LopHoc;
NgayThang NgaySinh;
<span style="color:Blue; int SoSachMuon;
<span style="color:Blue; public:

SinhVien()
{
NgayThang::NgayThang();

MSSV = <span style="color:#A31515; "Chua biet";
HoTen = <span style="color:#A31515; "Chua biet";
LopHoc = <span style="color:#A31515; "Chua biet";
}

SinhVien NhapSV();
<span style="color:Blue; void XuatSV(SinhVien a);

};

SinhVien SinhVien::NhapSV()
{
SinhVien a;
cout<<<span style="color:#A31515; "Nhap MSSV: ";
a.MSSV = (<span style="color:Blue; char*)malloc(<span style="color:Blue; sizeof(<span style="color:Blue; char));
fflush(stdin);
gets(a.MSSV);

cout<<<span style="color:#A31515; "Nhap Ho Ten: ";
a.HoTen = (<span style="color:Blue; char*)malloc(<span style="color:Blue; sizeof(<span style="color:Blue; char));
fflush(stdin);
gets(a.HoTen);

cout<<<span style="color:#A31515; "Nhap Ngay thang nam sinh "<<endl;
a.NgaySinh.Nhap();

cout<<<span style="color:#A31515; "Nhap Lop Hoc: ";
a.LopHoc = (<span style="color:Blue; char*)malloc(<span style="color:Blue; sizeof(<span style="color:Blue; char));
fflush(stdin);
gets(a.LopHoc);

<span style="color:Blue; return a;
}

<span style="color:Blue; void SinhVien::XuatSV(SinhVien a)
{
cout<<<span style="color:#A31515; "MSSV: "<<a.MSSV<<endl;
cout<<<span style="color:#A31515; "Ho Ten: "<<a.HoTen<<endl;
cout<<<span style="color:#A31515; "Ngay sinh: ";
a.NgaySinh.Xuat();
cout<<endl<<<span style="color:#A31515; "Lop: "<<a.LopHoc<<endl;
}

[/code]

Sach.h

<div style="color:Black;background-color:White; <pre>
#pragma once

<span style="color:Blue; class Sach
{
<span style="color:Blue; private:
<span style="color:Blue; char *MaSach, *TenSach, *TacGia, *TheLoai;
<span style="color:Blue; int TongLuotMuon;
<span style="color:Blue; public:
Sach()
{
MaSach = <span style="color:#A31515; "Chua biet";
TenSach = <span style="color:#A31515; "Chua biet";
TacGia = <span style="color:#A31515; "Chua biet";
TheLoai = <span style="color:#A31515; "Chua biet";
}

Sach NhapSach();
<span style="color:Blue; void XuatSach(Sach a);
};

Sach Sach::NhapSach()
{
Sach a;
cout<<<span style="color:#A31515; "Nhap Ma Sach: ";
a.MaSach = (<span style="color:Blue; char*)malloc(<span style="color:Blue; sizeof(<span style="color:Blue; char));
fflush(stdin);
gets(a.MaSach);

cout<<<span style="color:#A31515; "Nhap Ten Sach: ";
a.TenSach = (<span style="color:Blue; char*)malloc(<span style="color:Blue; sizeof(<span style="color:Blue; char));
fflush(stdin);
gets(a.TenSach);

cout<<<span style="color:#A31515; "Nhap Ten Tac Gia: ";
a.TacGia = (<span style="color:Blue; char*)malloc(<span style="color:Blue; sizeof(<span style="color:Blue; char));
fflush(stdin);
gets(a.TacGia);

cout<<<span style="color:#A31515; "Nhap The Loai: ";
a.TheLoai = (<span style="color:Blue; char*)malloc(<span style="color:Blue; sizeof(<span style="color:Blue; char));
fflush(stdin);
gets(a.TheLoai);

<span style="color:Blue; return a;
}

<span style="color:Blue; void Sach::XuatSach(Sach a)
{
cout<<<span style="color:#A31515; "Ma Sach: "<<a.MaSach<<endl;
cout<<<span style="color:#A31515; "Ten Sach: "<<a.TenSach<<endl;
cout<<<span style="color:#A31515; "Ten Tac Gia: "<<a.TacGia<<endl;
cout<<<span style="color:#A31515; "The loai sach: "<<a.TheLoai<<endl;
}
[/code]

In the begining, I tried to overload the operator >> and << for inputing and outputing the date, which described in NgayThang.h. But after that, I got the error like the title. Then I commented the ostream &operator<<(ostream
&output, const NgayThang &ngaythang) and istream &operator>>(istream &input, NgayThang &ngaythang)
method, but the error Error<span style="white-space:pre
68<span style="white-space:pre error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
still happens. Now I get serious trouble. Please help me.
Thank you.

View the full article
 
Back
Top