I am getting some error message that is saying 'Error: identifier 'XXXX' out of scope' in VS 2012.
I found this still happens with even very simple class as below.
// this is header file
public class IRIS_Database
{
public:
int test1;
IRIS_Database::IRIS_Database(void);
IRIS_Database::~IRIS_Database(void);
};
// this is cpp file
#include "IRIS_Database.h"
/*******************
Constructor
********************/
IRIS_Database::IRIS_Database(void)
{
test1 = 5;
int test2 = 20;
}
/*****************
Destructor
******************/
IRIS_Database::~IRIS_Database(void)
{
}
I put break point inside of constructor and added test1 and test2 on watch. Here is screenshot.
As you can see image, test1 that is declared in header file is 'out of scope'. The test2, local variable that is declared in constructor, is OK. I can track test2 but not test1.
Here is code that initiate this class from main function.
/*********************
Main Function
**********************/
int _tmain(int argc, _TCHAR* argv[])
{
// Initialize Database
IRIS_Database* IRDB = new IRIS_Database();
}
I am not sure why...
Optimization is disabled in project property and this is running as debug mode. My code is C++/CLI mixed with Windows forms. So, /clr option is enabled. Platform Toolset is v110 which is VS 2012. Here is all options from property page. If you want to see specific options please let me know.
/GS /analyze- /W3 /Zc:wchar_t /I"../IRDB_Include" /Zi /Od /sdl- /Fd"Debug\vc110.pdb" /fp:precise /D "_CRT_SECURE_NO_WARNINGS" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /errorReport:prompt /WX- /Zc:forScope /Oy- /clr /FU"C:\Program Files\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\mscorlib.dll" /FU"C:\Program Files\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\System.Data.dll" /FU"C:\Program Files\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\System.dll" /FU"C:\Program Files\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\System.Drawing.dll" /FU"C:\Program Files\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\System.Windows.Forms.dll" /FU"C:\Program Files\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\System.Xml.dll" /MDd /Fa"Debug\" /EHa /nologo /Fo"Debug\" /Fp"Debug\NearIR.pch"
Thanks in advance!