Functions within external files

Hello everyone, I have a question.

I am receiving a scope declaration error when trying to use 2 functions from within an external file. Function 1 calls function 2 and then returns to function 1.
However, if a call an external function from main() that does not interact with another function, there are no errors.

Error: 'Test2' was not declared in this scope

I am including a simplified example here:

//Contents of external.cpp
#include "external.h"

int Test1(int z)
{
z = Test2(5);
return z;
}

int Test2(int y)
{
y = y + 1;
return y;
}

Last edited on
You haven't shown external.h

PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post.
http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.
I have solved the issue.

Deleted both .h and .cpp
Created new .h and .cpp and pasted the code. No problems now....
Topic archived. No new replies allowed.