error C2512: 'CFileDialog' : no appropriate default constructor available
解决方案 »
- CXImage图像格式转换问题
- release版本下创建的lib文件,在debug程序中使用出错
- 关于DLLMAIN
- 如何通过资源ID获取资源的文件名
- CDumpContext类声明的一个比较奇怪的问题
- ado访问MySQL的带OUT参数的存储过程时出错!
- 求中文手写识别(鼠标,非手写板)程序或资料
- 诡异问题之四 妈的又是指针!!
- 想问一个问题,可能对我的影响比较大。希望可以听听你们的意见!
- Debug Assertion Failed!问题,Strcore.cpp文件错误,如何调试??
- 在dos环境下使用make,如何将标准输出信息和出错信息重定向到一个文件中。
- 只这样加一句话就运行出错了,请帮忙,谢谢!
class CGfxInComboDlg : public CFileDialog
{
public:
CGfxInComboDlg(BOOL bOpenFileDialog,
LPCTSTR lpszDefExt,
LPCTSTR lpszFileName ,
DWORD dwFlags ,
LPCTSTR lpszFilter,
CWnd* pParentWnd );
CFileDialog( BOOL bOpenFileDialog, LPCTSTR lpszDefExt = NULL, LPCTSTR lpszFileName = NULL, DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, LPCTSTR lpszFilter = NULL, CWnd* pParentWnd = NULL );也就是說他需要至少一個參數。
把你的構造函數改為:
CGfxInComboDlg(BOOL bOpenFileDialog,
LPCTSTR lpszDefExt,
LPCTSTR lpszFileName ,
DWORD dwFlags ,
LPCTSTR lpszFilter,
CWnd* pParentWnd ):CFileDialog(bool bOpenFileDialog); (在CPP 裡)
就對了。
GfxincomboDlg.cpp(25) : error C2144: syntax error : missing ')' before type 'bool'
GfxincomboDlg.cpp(25) : error C2612: trailing 'auto' illegal in base/member initializer list
GfxincomboDlg.cpp(25) : error C2512: 'CFileDialog' : no appropriate default constructor available
GfxincomboDlg.cpp(25) : error C2059: syntax error : ')'
GfxincomboDlg.cpp(26) : error C2082: redefinition of formal parameter 'bOpenFileDialog'
GfxincomboDlg.cpp(26) : error C2601: 'bOpenFileDialog' : local function definitions are illegal
GfxincomboDlg.cpp(26) : error C2063: 'bOpenFileDialog' : not a function
GfxincomboDlg.cpp(42) : error C2143: syntax error : missing ';' before '{'
GfxincomboDlg.cpp(46) : error C2601: '_GetBaseMessageMap' : local function definitions are illegal
GfxincomboDlg.cpp(46) : error C2601: 'GetMessageMap' : local function definitions are illegal
GfxincomboDlg.cpp(46) : error C2655: 'messageMap' : definition or redeclaration illegal in current scope
gfxincombodlg.h(55) : see declaration of 'messageMap'
GfxincomboDlg.cpp(46) : error C2655: '_messageEntries' : definition or redeclaration illegal in current scope
gfxincombodlg.h(55) : see declaration of '_messageEntries'
GfxincomboDlg.cpp(57) : error C2601: 'OnKillFocus' : local function definitions are illegal
GfxincomboDlg.cpp(73) : error C2601: 'OnLButtonUp' : local function definitions are illegal
GfxincomboDlg.cpp(110) : error C2601: 'PreTranslateMessage' : local function definitions are illegal
GfxincomboDlg.cpp(155) : fatal error C1004: unexpected end of file found
Generating Code...
Error executing cl.exe.- 16 error(s), 0 warning(s)这是我的源码
GfxincomDlg.h:
class CGfxInComboDlg : public CFileDialog
{
// Construction
public:
CGfxInComboDlg(BOOL bOpenFileDialog,
LPCTSTR lpszDefExt,
LPCTSTR lpszFileName ,
DWORD dwFlags ,
LPCTSTR lpszFilter,
CWnd* pParentWnd );// Attributes
public:
CGfxInCombo * pCombo;
int iLastSel;
CString csLastItem;// Operations
public:// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CGfxInComboList)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
//}}AFX_VIRTUAL// Implementation
public:
virtual ~CGfxInComboDlg(); // Generated message map functions
protected:
//{{AFX_MSG(CGfxInComboList)
afx_msg void OnKillFocus(CWnd* pNewWnd);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
//}}AFX_MSG DECLARE_MESSAGE_MAP()
};
GfxincomDlg.CPP:
CGfxInComboDlg::CGfxInComboDlg(BOOL bOpenFileDialog,
LPCTSTR lpszDefExt,
LPCTSTR lpszFileName ,
DWORD dwFlags ,
LPCTSTR lpszFilter,
CWnd* pParentWnd ) :CFileDialog(bool bOpenFileDialog)
{
pCombo = NULL;
iLastSel = -1;
bOpenFileDialog = TRUE,
lpszDefExt = "mp3",
lpszFileName = "",
dwFlags = OFN_ALLOWMULTISELECT |
OFN_FILEMUSTEXIST |
OFN_HIDEREADONLY |
OFN_EXPLORER,
lpszFilter = "MPEG Audio Files {*.mp3}|*.mp3|All Files {*.*}|*.*||",
pParentWnd = GetParent();}CGfxInComboDlg::~CGfxInComboDlg()
{
}
...
...
afx_msg void .....和pretranslatemessage等代码....
我估计可能是你键入的字符有问题....
你是用中文输入法还是拷贝的字符????
你用windows英文输入法再重新输一遍代码试试.....
LPCTSTR lpszDefExt,
LPCTSTR lpszFileName ,
DWORD dwFlags ,
LPCTSTR lpszFilter,
CWnd* pParentWnd ) :CFileDialog(bool bOpenFileDialog)
//应该是CFileDialog(bOpenFileDialog)
你多加了一个bool