Hi all,
A bit of advice using MFC needed really. I want to be able to set a variable m_PopSize (which is declared in "App.h") to generate an array (LineArray) of objects in "Doc.cpp" whoose size depends on the value stored in m_PopSize. e.g. is PopSize is 100 then:
LineArray[100].
I seem to have to do it this way because if i put
LineArray[m_PopSize] it says it expects a constant even if i declare m_PopSize as a const int.

Any way, on OnNewDocument() I want to create this array. So I have put in the following bit of code.
Code:
BOOL CWinLinesDoc::OnNewDocument()
{
	if (!CDocument::OnNewDocument())
		return FALSE;

	// TODO: add reinitialization code here
	poly4toline4(); //set up the map for vector usage
	srand( (unsigned)time( NULL ) ); //get time for random numbers
	HasGenerateDone = 0;//generate button has not been pressed yet
	BestSearch = 0;
	if(CWinLinesApp.m_PopSize == 100)
		CLine LineArray[100];


	// (SDI documents will reuse this document)

	return TRUE;
}
Note this was just a test, normally I would include if(m_PopSize == ) for all the other possibilities. However when I try and run this it says:
Code:
\WinLinesDoc.cpp(54) : error C2143: syntax error : missing ')' before '.'
if I omitt the CWinLinesApp bit it says that m_PopSize is not defined. Is there any way to get around this, or even better a way I can initialise an object array without needing a const variable.
Many thanks for your time.
Dylan