Hi,
I'm trying to make a type definition and a vector (based on that type definition) global to all my forms in vc++ and it isn't working.
I have one file named "Brians_Globals.h" which is as follows:
and a file named "Brians_Globals.cpp" as follows:Code:#ifndef NAMESPACE_BRIAN #define NAMESPACE_BRIAN extern int id; extern int credit; extern struct CustomerRecords { std::string Building; std::string Notes; std::string PrimaryContact; std::string PrimaryNumber; std::string SecondaryContact; std::string SecondaryNumber; std::string Address1; std::string Address2; std::string City; std::string State; std::string ZipCode; std::string ClientSince; std::string Rate; std::string PerCycle; std::string PaymentDue; }; extern typedef pair<std::string, struct CustomerRecords> my_pair; extern vector<my_pair> data; extern std::string bri; #endif
Then I use:Code:#include "stdafx.h" #include <string> using namespace std; string bri; struct CustomerRecords; typedef my_pair; vector<my_pair> data; int id; int credit;
in any of the forms in the vc++ project application that need access to the globals as necessary.Code:#include "Brians_Globals.h"
When I comment out both the
from the "Brians_Globals.cpp" file and theCode:typedef my_pair; vector<my_pair> data;
from the "Brians_Globals.h" file, then everything compiles and the globals can be used in my form files as desired, but if the above aren't commented out, then many, many errors occur. Thus I know that theCode:extern typedef pair<std::string, struct CustomerRecords> my_pair; extern vector<my_pair> data;
from the "Brians_Globals.cpp" are declared wrong. How should I declare them in the file?Code:typedef my_pair; vector<my_pair> data;




Reply With Quote
