I'm having some frustrations using VS8. Simple code that compiles cleanly in VS7 is generating errors in VS8.

If I convert a project from VS7 to VS8 it compiles cleanly, but if I create a new project using the same code, it doesn't compile.

Example:

Code:
// ConvertTest.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>
#include "ConvertTest.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// The one and only application object

CWinApp theApp;

using namespace std;

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))
    {
        // TODO: change error code to suit your needs
        _tprintf(_T("Fatal Error: MFC initialization failed\n"));
        nRetCode = 1;
    }
    else
    {
        CString text = "180";
        WORD value = atoi(text);
        cout << "Value=" << value << endl;
    }

    return nRetCode;
}
The above will compile and run in VS7. If I then open in VS8, it converts -- and still runs. But if I generate a new project in VS8 with the same code, I get errors.

The compiler doesn't like how the CString is initialized, and while you can fix it by doing CString text = _T("180"); the MSDN entry for CString basic operations states:

You can assign C-style literal strings to a CString just as you can assign one CString object to another:

Assign the value of a C literal string to a CString object:

Copy Code
CString myString = "This is a test";

Next, the compiler is not happy with passing a CString to atoi. It says, "cannot convert parameter 1 from 'CString' to 'const char *'. Has the basic operator overload been lost with VS8? Or is this another case of standards being enforced? Do I have to access the buffer to pass a CString to an LPCSTR where I used to just pass the CString?

Thanks