Error in VC++ (missing ';' before return)

Hello!

I am working in Visual C++ 2010 Express. I have the following code:

main.cpp

1
2
3
4
5
6
7
8
#include "stdafx.h"
#include"functions.h"
int main()
{}
int add(int a, int b)
	return (a+b);
int multiply(int a, int b)
	return (a*b);


And functions.h

1
2
3
4
5
6
7
#ifndef FUNCTIONS_H_INCLUDED
#define FUNCTIONS_H_INCLUDED

int add(int a, int b);
int multiply(int a, int b);

#endif 


When I compile main.cpp I have the following error:

1
2
d:\visual c++ projects\k\k\main.cpp(6): error C2143: syntax error : missing ';' before 'return'
d:\visual c++ projects\k\k\main.cpp(8): error C2143: syntax error : missing ';' before 'return'


I don't see the mistake. Please help me.

Thank you respectfully.
First, read the following tutorial and have another go yourself. It's better if you work it out for yourself!

Functions
http://www.cplusplus.com/doc/tutorial/functions/

Of course, if you still can't work it out, then do get back to us.

Andy
Last edited on
where are your {}?
I solved it. The brackets were the problem. I was so wired in so that I forgot those. Thank you.
Topic archived. No new replies allowed.