Vectors

Hi,

I am trying to declare a vector of type CSrting in my dialog. But I am gettting errors.
I already included  #include <vector>  and #include <CString> in my header file.

//ProgramDlg.h

class CProgramDlg : public CDialog
{
public:
      CProgramDlg(CWnd* pParent = NULL);
      vector<CString> database;

//When I compile, I get the following error
syntax error : missing ';' before '<'
'vector' : missing storage-class or type specifiers
syntax error : '<'
unexpected token(s) preceding ';'
LVL 1
mfcseekerAsked:
Who is Participating?
 
dkloeckConnect With a Mentor Commented:
u can find an example at http://www.codeguru.com/mfc/comments/5037.shtml

maybe there u can find ur problemm
0
 
SteHCommented:
Do you really include <CString>? CStrings are declared in afx.h which is included with stdafx.h if you created a MFC app with the app wizard. Are you looking for a string vector?

#include <vector>
#include <string>

using namespace std;
vector<string> database;

Or in your code you should use std:: for scope resolution:
   #include <vector>
   [snip]

   std::vector<CString> database;
0
 
mfcseekerAuthor Commented:
Silly mistake, was missing "using namespace...

Thanks
0
All Courses

From novice to tech pro — start learning today.