Can some one tell me why this compiles under VC.Net in Debug but not Release mode?
The error message I get is C2365: 'log' : redefinition; previous definition was a 'member function'
Code:// CString.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> #include "CString.h" #ifdef _DEBUG #define new DEBUG_NEW #endif using std::cout; using std::endl; class Log { int x; public: Log() { x = 5; } int GetX() { return x; } }; Log log; // The one and only application object CWinApp theApp; int _tmain(int argc, TCHAR* argv[], TCHAR* envp[]) { int nRetCode = 0; // initialize MFC and print and error on failure if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0)) { nRetCode = 1; } else { cout << log.GetX() << endl; } return nRetCode; }




Reply With Quote