Hi all,
I have these .CPP files ("Main.cpp" and "RandomFunction.cpp"):
Code:/*
* "Main.cpp"
*/
#include "RandomFunction.cpp"
int main()
{
randomFunction();
}
But when I launch the program, the compiler gives me a linker error: "RandomFunction.obj : error LNK2005: "void __cdecl randomFunction(void)" (?randomFunction@@YAXXZ) already defined in Main.obj"Code:/*
* "RandomFunction.cpp"
*/
void randomFunction()
{
// Do some stuff
}
So how should I rewrite the code to fix the linker error (I think I should define somewhere the extern function)?
Thanks.
Petike