Click here to Skip to main content
15,885,244 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I have created basic programs in the past using constructors and destructors but I do not understand why (using Visual Studio 2019) these errors are coming up.


Language.h

#ifndef LANGUAGES_H_ 
#define LANGUAGES_H_ 

class Languages {
public:
	void show();
Error here:explicit type is missing (int assumed)-->   	Language();
Error: Function definition for ~Language not found-->	~Language();
};

#endif /* LANGUAGES_H_ */ 

-----------------------------------------------------
**NOTE: Error is showing "Explicit type is missing ("int" assumed).

Languages.cpp
#include <iostream>
#include "Languages.h"

using namespace std;

Error appears on this line-->Languages::Language() {

}

Languages::~Language() {

}


What I have tried:

I have no idea what I am doing but I am having fun. I have progressed to the point where I realise that perhaps it might be a good idea to understand what the errors actually mean.

What I have tried:
1. I looked on Stack Overflow and one suggestion was to add void to the constructor in the header file but that did not resolve anything.
2. I have also tried adding int and string but the errors are still there.
Posted
Updated 27-Sep-22 21:05pm
Comments
11917640 Member 28-Sep-22 1:53am    
Languages vs Language.
Richard MacCutchan 28-Sep-22 6:25am    
It might be a better idea to read your code carefully, and see where you have typed Language instead of Languages, with a trailing 's'.

1 solution

As 11917640 Member suggested, the 'name' of the constructor must match the class one.
So, if you have the Languages class, then you must exactly name is constructor Languages (and is destructor ~Languages).
i.e. you constructor lacks the final 's'.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900