alzzz
asked on
Function already defined Error, Visual C++
hey,
I'm trying to create a GUI in Visual Studio, but when i run through that piece of code but i get the errors:
Error 1 error LNK2005: "public: void __clrcall Input::Score0(void)" (?Score0@Input@@$$FQAMXXZ) already defined in cricket_i1_v00.obj Input.obj cricket_i1_v00
Error 3 fatal error LNK1169: one or more multiply defined symbols found C:\Documents and Settings\hlepretre\MyC++Co des\cricke t_i1_v00\D ebug\crick et_i1_v00. exe 1 cricket_i1_v00
My code is:
Input.cpp
class Input
{
public:
int RunsScored[11];
void Score0();
};
void Input::Score0()
{
RunsScored[0]=1;
}
in the main function i reference it this way:
#include "Input.cpp"
and call it this way
Input ins;
ins.Score0();
this->txtB->Text = ins.RunsScored[0].ToString ();
Do you have an idea of where the error comes from?
Thanks
I'm trying to create a GUI in Visual Studio, but when i run through that piece of code but i get the errors:
Error 1 error LNK2005: "public: void __clrcall Input::Score0(void)" (?Score0@Input@@$$FQAMXXZ)
Error 3 fatal error LNK1169: one or more multiply defined symbols found C:\Documents and Settings\hlepretre\MyC++Co
My code is:
Input.cpp
class Input
{
public:
int RunsScored[11];
void Score0();
};
void Input::Score0()
{
RunsScored[0]=1;
}
in the main function i reference it this way:
#include "Input.cpp"
and call it this way
Input ins;
ins.Score0();
this->txtB->Text = ins.RunsScored[0].ToString
Do you have an idea of where the error comes from?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks to you both
ASKER