Solved

Vectors

Posted on 2003-11-20
3
251 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
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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. …
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.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now