I have a problem in which a global vector that I've defined (as an extern) has 1,000,000 members before I even put anything in it. I originally wrote this code as a Win32 application and it worked just fine. I'm now porting it over to Windows Forms and I'm running into this issue. The vector is called "parsed_Commands", and the program is organized as follows:
#include "stdafx.h"
#include "Form1.h"
#include "DataStructs.h"
usingnamespace SpecControl2;
usingnamespace System;
usingnamespace System::Drawing;
usingnamespace System::Windows::Forms;
usingnamespace System::Security::Permissions;
std::vector<proc_cmd> parsed_Commands;
[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
parsed_Commands.clear();
// Enabling Windows XP visual effects before any controls are created
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
// Create the main window and run it
Form1^ Main_Form = gcnew Form1();
Application::Run(Main_Form);
return 0;
}
If I set a breakpoint in Main.cpp at the line "Application::EnableVisualStyles();" and then try to expand the parsed_Commands vector in Visual Studio 2012, it tells me that the vector has more than 1,000,000 members and asks if I'm sure I want to expand it. The vector should be completely empty; I just declared it and cleared it. Again, this worked flawlessly in the original Win32 code, even without the clearing. I've also tried defining the extern vector in Datastructs.h and eliminating it from stdafx.h, but this didn't help. Does anyone know what could be going on?