Class issue Urgent help

Hi,

I have a class that I'm pretty sure should compile but could be a bad instalation not sure.

THis is the following code if some one could compile it would be really appreciated. THis is URGENT as I need to beable to do this by tonight!

The follopwing application is a console application

// T.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>
#include "print.h"

int main()
{
addsub Math;
std::cout<<"print classn";
std::cout<<Math.Add(20,30);
return 0;
}

This is the scond cpp file

#include "stdafx.h"
#include "print.h"

int addsub::Add(int A, int B)
{
a1 = A;
b1 = B;

return(a1 +b1);
}

The header file for the second cpp

#include "stdafx.h"

class addsub
{
public:
int Add(int A, int B);
int Sub(int A, int B);
private:
int a1;
int b1;
}



These are the errors I'm getting:

1>------ Build started: Project: T, Configuration: Debug Win32 ------
1>Compiling...
1>T.cpp
1>c:documents and settingsn0225890my documentsvisual studio 2008projectsttt.cpp(10) : error C2628: 'addsub' followed by 'int' is illegal (did you forget a ';'?)
1>c:documents and settingsn0225890my documentsvisual studio 2008projectsttt.cpp(11) : error C3874: return type of 'wmain' should be 'int' instead of 'addsub'
1>c:documents and settingsn0225890my documentsvisual studio 2008projectsttt.cpp(16) : error C2664: 'addsub::addsub(const addsub &)' : cannot convert parameter 1 from 'int' to 'const addsub &'
1> Reason: cannot convert from 'int' to 'const addsub'
1> No constructor could take the source type, or constructor overload resolution was ambiguous
1>print.cpp
1>c:documents and settingsn0225890my documentsvisual studio 2008projectsttprint.cpp(11) : error C2556: 'addsub addsub::Add(int,int)' : overloaded function differs only by return type from 'int addsub::Add(int,int)'
1> c:documents and settingsn0225890my documentsvisual studio 2008projectsttprint.h(6) : see declaration of 'addsub::Add'
1>c:documents and settingsn0225890my documentsvisual studio 2008projectsttprint.cpp(11) : error C2371: 'addsub::Add' : redefinition; different basic types
1> c:documents and settingsn0225890my documentsvisual studio 2008projectsttprint.h(6) : see declaration of 'addsub::Add'
1>Generating Code...
1>Build log was saved at "file://c:Documents and SettingsN0225890My DocumentsVisual Studio 2008ProjectsTTDebugBuildLog.htm"
1>T - 5 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Last edited on
You're missing a semicolon at the end of the class declaration.
You forgot a ';' at the end of 'class addsub'
Topic archived. No new replies allowed.