Solved

Vectors

Posted on 2003-11-20
3
289 Views
Last Modified: 2013-11-20
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 ';'
0
Comment
Question by:mfcseeker
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 10

Accepted Solution

by:
dkloeck earned 20 total points
ID: 9788457
u can find an example at http://www.codeguru.com/mfc/comments/5037.shtml

maybe there u can find ur problemm
0
 
LVL 13

Expert Comment

by:SteH
ID: 9788663
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
 
LVL 1

Author Comment

by:mfcseeker
ID: 9788867
Silly mistake, was missing "using namespace...

Thanks
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question