I have a declaration of an inline function that happens to be recursive. Since it's recursive there is no point in declaring it inline so why does my linkage fail when i remove it?
3 files:
\\File1.h
#ifndef FILE1_H
#define FILE1_H
inline int Factorial(int a)
{
if (a < 2)
return 1;
return a*Factorial(a-1);
}
int PermutationsNum(int b);
#endif
\\File1.cpp
#include "File1.h"
int PermutationsNum(int b)
{
return Factorial(b);
}
\\File2.cpp
#include <iostream>
#include "File1.h"
int main()
{
std::cout << "permutations of 7 elements: " << PermutationsNum(7) << std::endl;
return 0;
}