locked
Error: name followed by :: must be a class or namespace name RRS feed

  • Question

  • I'm using Windows 8 RP with VS2012RC.

    I write a class similar to DirectXBase class provided in code sample Direct3DTutorial, Lesson 5. I add the member below into the class

    Platform::Agile<Windows::UI::Core::CoreWindow>  m_window;

    The issue is word UI is underlined in red, with tooltip text said:

    class platform::Agile<<error_type>>

    Error: name followed by '::' must be a class or namepace name.

    I've included the file "pch.h" in the source code, the content of which is

    #pragma once
    
    #include <wrl.h>
    #include <d3d11_1.h>
    #include <d2d1_1.h>
    #include <d2d1effects.h>
    #include <dwrite_1.h> // for IDWriteFactory1
    #include <wincodec.h> // for IWICImagingFactory2
    #include <agile.h>
    #include "basicmath.h"
    

    Tuesday, July 10, 2012 4:52 PM

Answers

All replies

  • What sample or type of project template are you using to create this condition?

    David Lamb

    Wednesday, July 11, 2012 1:20 AM
    Moderator
  • Hi, it's a static library project. The project files are generated using CMake, instead of Visual Studio "New Project" wizard.
    Wednesday, July 11, 2012 10:50 AM
  • See if this is the reference you are missing:

    #include <CoreWindow.h>


    David Lamb

    Wednesday, July 11, 2012 6:26 PM
    Moderator
  • Hi, when I add the line

    #include <CoreWindow.h>

    VS reports "Error, cannot open source file “CoreWindow.h"

    I also search the Windows SDK directory "C:\Program Files (x86)\Windows Kits\8.0\Include" and there is no file named "CoreWindow.h".

    Thursday, July 12, 2012 10:46 AM
  • Look here: C:\Program Files (x86)\Windows Kits\8.0\Include\winrt\CoreWindow.h


    David Lamb

    Thursday, July 12, 2012 8:07 PM
    Moderator
  • The file is not there. I forget to mention that I use the express edition. But I have no problem in building and running a couple of code samples. For example, when I open Direct3DTutorial solution, VS2012RC does not give any error to the line

    Platform::Agile<Windows::UI::Core::CoreWindow>  m_window;
    Maybe CMake does not support VS2012 very well and generates incorrect project configurations.
    Friday, July 13, 2012 2:05 AM
  • It is actually an issue with the Static library (for Metro style apps) project type in VS 2012RC. As a workaround for now, since you are using Express you can install the SDK separately to get the header I mentioned here: Windows Software Development Kit (SDK) for Windows 8 Release Preview.


    David Lamb

    • Marked as answer by Jesse Jiang Tuesday, July 17, 2012 5:51 AM
    Friday, July 13, 2012 5:44 PM
    Moderator
  • Is there an offline installer of SDK for Windows 8?
    Saturday, July 14, 2012 4:07 PM
  • There is. See this thread from the tools forum: Windows 8 SDK Standalone Installer

    David Lamb

    • Marked as answer by Leonard Tuesday, July 17, 2012 12:37 PM
    • Unmarked as answer by Leonard Wednesday, July 18, 2012 10:17 AM
    Monday, July 16, 2012 8:14 PM
    Moderator
  • Thanks.
    Tuesday, July 17, 2012 12:37 PM
  • I've installed SDK and included CoreWindow.h, but the error remains.
    Wednesday, July 18, 2012 10:17 AM