VC中的全局对象要怎做声明?
例如:<AAA.h>中
CString a,b,c; //全局对象
bool SplitFile(bool,bool); //Function head
<stdafx.h>中
#include "AAA.h"
<BBB.cpp>中
#include "stdafx.h"
void C123Dlg::OnOpenFile()
{
CFileDialog dlg(true);
CString msg = dlg.GetPathName();
控件对象.SetWindowText(msg);
a=msg;
int i=a.ReverseFind("\\");
int j=a.GetLength()-i;
b=a.Mid(0,i) + "\\";
c= dlg.GetFileTitle();
UpdateData(false);
if (QQQ(True,True)!=True)
{
.....
}
......
}
<CCC.cpp>中
#include "stdafx.h"
bool QQQ(bool ss,bool dd) //这段主要做单档(>1GB)切割成批次档用~
{
CFile m_file;
CFileDialog dlg(TRUE);
CString AA,BB,CC;
AA=a;BB=b;CC=c;
.......
}
为何这样写Compliar时一直出现
.....CString a already defined in StdAfx.obj
.....CString b already defined in StdAfx.obj
.....CString c already defined in StdAfx.obj
非得要用局域对象当参数传递才会正常?
不太懂MFC~越写越像C~
只要设成全局就一定Error!
[ 本帖最后由 wube 于 2012-2-8 19:40 编辑 ]