Solved

Vectors

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

Suggested Solutions

Title # Comments Views Activity
Show shut-down message as Windows 8 shuts down. 9 99
WinWaitActive parameters 12 31
wordmultiple challenge 12 141
Detect file exist or not 3 179
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

860 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