You can't use a function outside of a function or any other executable part of the program.
Your program is equivalent to
#include <cstdio>
#include <iostream>
#include <fstream>
#define INPUT_FILE
freopen("test.txt", "r", stdin); // Makes no sense
using namespace std;
int main(int argc, char const *argv[])
{
int n;
while(scanf("%d", &n))
printf("%d\n", n);
return 0;
}