[ERROR] Class error

So i have a c++ file like this
login.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <iostream>
#include "login.h"

using namespace std;
login::login();
{

	cout<<"banana";




}


login.h
1
2
3
4
5
6
7
8
9
10
11
#ifndef LOGIN_H
#define LOGIN_H

class login;
{
public:
	login();

};

#endif; 

source1.cpp
1
2
3
4
5
6
7
8
9
10
11
#include<iostream>
#include "login.h"
using namespace std;
void main()
{
	login log;




	}


And i would like to know where the error is please
Remove semicolon at the end of line 5 in login.cpp.

Remove semicolon at the end of line 4 and 11 in login.h.

main() should have return type int.
source1.cpp
1
2
3
4
5
6
7
8
9
10
11
#include<iostream>
#include "login.h"
using namespace std;
int main()
{
	login log;

	return 0;


	}

login.h
1
2
3
4
5
6
7
8
9
10
11
#ifndef LOGIN_H
#define LOGIN_H

class login
{
public:
	login();

};

#endif 

login.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <iostream>
#include "login.h"

using namespace std;
login::login()
{

	cout<<"banana";




}

Error 1 error C2143: syntax error : missing ';' before 'using
Last edited on
The compiler error should be more than that. It should tell you what line too
Error 1 error C2143: syntax error : missing ';' before 'using' c:\users\user\documents\visual studio 2012\projects\consoleapplication3\consoleapplication3\debug\source1.cpp 3 1 ConsoleApplication3
The 3 stands for line and 1 for column
Last edited on
Are you sure your code posted is identical to your source files? That error indicates that the ending } of the class login definition is missing a ; but the code you posted has it. (line 9 of login.h)
It is identical. I think it was supposed to work but can this be due to compiler errors?I recently had a problem with it and i fixed it by going file>move the file in question but the error stopped popping up.
That code compiles for me. I suggest deleting the solution and starting again as you're likely buggered something up :)
ok thanks for help ^^
Topic archived. No new replies allowed.