I have the following structure and structure object defined in the header file, as shown below:
struct STConfigurationDetails
{
bool bAutoStart;
bool bAutoLog;
bool bAutoScan;
bool bAutoMount;
bool bAutoOpen;
bool bAutoDetectLast;
};
struct STConfigurationDetails g_objConfigurationDetails ;
In the header file, I have both the body of the method and the method that uses g_objConfigurationDetails. This works fine when I include the header file in another cpp file and call the method. But as soon as I added the header file to another cpp file, I got an error:
Error 1 error LNK2005: "struct STConfigurationDetails g_objConfigurationDetails" (? G_objConfigurationDetails @@ 3USTConfigurationDetails @@ A) already defined in NDSClientDlg.obj NDSConnectDlg.obj NDSClient
2 LNK1169: d:\FromClearCase\Development_view\NDS_11152010\exe\Debug\NDSClient.exe 1 NDSClient
, , . , , te.
, CPP?