• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 201
  • Last Modified:

About Constructor of CMyDiaog!

class CDSub : public CDialog
{
// Construction
public:
      CDSub(CWnd* pParent = NULL);   // standard constructor
      CDSub(list<string > values,CWnd *pParent);
.....
}
/////////in some .cpp ,i call
......
#include "DSub.h"
#include <list>
#include <string>
using namespace std;
.....
{

 list<string > x;
   x.push_back ("f1");
   x.push_back ("f2");

   CDSub s(x,this);
   s.DoModal ();
}
there are some wrong from compiler!what can i do!
0
fyf7262284
Asked:
fyf7262284
1 Solution
 
AndyAinscowCommented:
Instead of trying to do that in the constructor I would use a public function of your dialog to pass the list.

What error do you get from the compiler?
0
 
SteHCommented:
#include "DSub.h"
#include <list>
#include <string>
could be the wrong order since in DSub.h you have the declarations of your dlg class. That referrs to list and string.

try using
#include <list>
#include <string>
#include "DSub.h"
or include list and string inside DSub.h.
0
 
fyf7262284Author Commented:
thank you ! i have solved this problem!put the #nclude"DSub.h" top,and delete two line:##include <list> and #include <string>
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now