#include "UserInterface.h"
#include "functions.h"
usingnamespace std;
...//pause() and clear() are both used here
This is my main
1 2 3 4 5 6 7
#include "UserInterface.h"
#include "functions.h"
usingnamespace std;
int main()
{...}//pause() is used in main
I'm getting an error
1>UserInterface.obj : error LNK2005: "void __cdecl clear(void)" (?clear@@YAXXZ) already defined in main.obj
1>UserInterface.obj : error LNK2005: "void __cdecl pause(void)" (?pause@@YAXXZ) already defined in main.obj
1>C:\Users\MyName\Documents\Visual Studio 2010\Projects\experiment\Debug\UserInterface.exe : fatal error LNK1169: one or more multiply defined symbols found
This way, the implementations of these functions only appear in one "translation unit". The way you have it, the implementations appear both when compiling UserInterface.cpp and when compiling main.cpp.