Functions.h
#include <iostream>
#include <windows.h>
#include <conio.h>
#include <limits>
#include <stdexcept>
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include "definitions.h"
#include "globals.h"
};using namespace std;
This is in functions.h Now we have main.cpp that includes the header
Main.cpp
#include "functions.h"
int main(int argc, char *argv[])
{
//Other stuff
return 0;
}
For some reason I have to write }; before the using statement. It won’t let me compile unless that is before it.
Any ideas as to why?
This error is probably caused by a missing
};in theglobals.hfile.The preprocessor literally pastes the contents of the
#included header files into your source file. So if there is a syntax error in one of the header files, there will be a syntax error in the source file that includes it.And I know this doesn’t fix your problem, but you should never use
using namespace std;in a header file, as that pollutes the global namespace for every translation unit that includes that header. It’s much better to keepusing namespacestatements local to a single source file, or better yet, just type outstd::.