hello guys... I have a file MyClass.cpp inwhich I declared a vector array. I then added some string data to it and want to access it in MyProjDlg.cpp. It is dialoged based app in vc6. Here it is

MyClass.cpp
-----------
   using namespace std;
   typedef vector<LPTSTR> StudentData;

   //some code here...
   void someFunc()
   {
       //vector array
       StudentData std;
       //some loop
       std.push_back(stdentName);
   }

MyProjDlg.cpp
-------------

//Now here in [I]MyProjDlg.cpp[/I]...what should I do to access this vector array and 
//put that data in Listbox..here it is what I tried so far but no result

extern StudentData std;

    //some loop to enter this data in listbox....
    for (int i=0; i<5; i++)
       listbox.AddString(std.pop_back());

it is showing 7 defferent errors....any idea whats wrong im doing?

Don't use std in c++ programs as std is the name of a namespace.
You have to repeat the typedef statement in MyProjDlg.cpp

typedef vector<LPTSTR> StudentData;
extern StudentData  stdData;

Edited 6 Years Ago by Ancient Dragon: n/a

I have done exactly the same....but again these errors

error C2143: syntax error : missing ';' before '<'
error C2143: syntax error : missing ';' before '<'
error C2146: syntax error : missing ';' before identifier 'std'
error C2065: 'std': undeclared identifier
error C2146: syntax error : missing ';' before identifier 'std'
error C2065: 'std': undeclared identifier
error C2228: left of '.push_back' must have class/struct/union type
error C2143: syntax error : missing ';' before '<'
error C2143: syntax error : missing ';' before '<'
error C2146: syntax error : missing ';' before identifier 'std'
fatal error C1004: unexpected end of file found

Edited 6 Years Ago by muze: n/a

thanx for ur time...alot of web serfing gave me the result....FINALLY.

This article has been dead for over six months. Start a new discussion instead.