locked
MSDN c++ metro tutorial: the name dateconverter does not exist in the namespace "using:SimpleBlogReader"

    Question

  • Hi there,

    I've been following the MSDN c++ metro tutorial here(simple blog reader app):

    http://msdn.microsoft.com/en-us/library/windows/apps/hh465045.aspx

    And I'm stucked at the end of SimpleBlogReader part 1.0, where the tutorial instructs me to add the DateConverter.h to the project.

    I got compile error:

    1>------ Rebuild All started: Project: SimpleBlogReader, Configuration: Debug Win32 ------

    1>  pch.cpp

    1>  App.xaml.cpp

    1>  MainPage.xaml.cpp

    1>  XamlTypeInfo.Impl.g.cpp

    1>c:\users\yichaozh\documents\visual studio 2012\projects\simpleblogreader\simpleblogreader\dateconverter.h(12): error C2525: 'SimpleBlogReader::DateConverter::Convert' : The parameter 'culture' is named 'language' on the base function and must be matched in a published implementation (App.xaml.cpp)

    1>c:\users\yichaozh\documents\visual studio 2012\projects\simpleblogreader\simpleblogreader\dateconverter.h(23): error C2525: 'SimpleBlogReader::DateConverter::ConvertBack' : The parameter 'culture' is named 'language' on the base function and must be matched in a published implementation (App.xaml.cpp)

    1>c:\users\yichaozh\documents\visual studio 2012\projects\simpleblogreader\simpleblogreader\dateconverter.h(12): error C2525: 'SimpleBlogReader::DateConverter::Convert' : The parameter 'culture' is named 'language' on the base function and must be matched in a published implementation (MainPage.xaml.cpp)

    1>c:\users\yichaozh\documents\visual studio 2012\projects\simpleblogreader\simpleblogreader\dateconverter.h(23): error C2525: 'SimpleBlogReader::DateConverter::ConvertBack' : The parameter 'culture' is named 'language' on the base function and must be matched in a published implementation (MainPage.xaml.cpp)

    ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

    Basically I think I did everything as the tutorial said, but still get the above error messages.

    And I can see "local:DateConverter" in MainPage.xaml is underlined, saying: the name dateconverter does not exist in the namespace "using:SimpleBlogReader".

    Does anyone have this problem as well?

    Thursday, September 6, 2012 12:33 AM

All replies

  • Hi,

    You should create a head file named DateConverter.h, and then include to MainPage.xaml.h

    Please follow the To create a value converter class that implements IValueConverter section in this document
    http://msdn.microsoft.com/en-us/library/windows/apps/hh465045.aspx

    You can copy the codes into that head file.

    Best regards,
    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, September 6, 2012 7:01 AM
  • Thanks for the reply. I did create the new header file DateConverter.h, and included it in MainPage.xaml.h

    What does "The parameter 'culture' is named 'language' on the base function and must be matched in a published implementation" mean here?

    Thursday, September 6, 2012 5:43 PM
  • Hi,

     

    The whole project codes are here.

    http://code.msdn.microsoft.com/windowsapps/Getting-started-with-C-4159da98

     

    Please compare it with your project.

     

    Best regards,

    Jesse



    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by Jesse Jiang Monday, October 8, 2012 6:26 AM
    • Unmarked as answer by Jesse Jiang Monday, October 8, 2012 6:27 AM
    Tuesday, September 11, 2012 9:18 AM
  • I ran into exactly this problem with the Windows Store C++ Tutorial: http://msdn.microsoft.com/en-us/library/windows/apps/hh465045.aspx

    I could not find any documentation for this error:

    Error	2	error C2525: 'SimpleBlogReader::DateConverter::Convert' : The parameter 'culture' is named 'language' on the base function and must be matched in a published implementation (App.xaml.cpp)	c:\users\jimmy\documents\visual studio 2012\projects\simpleblogreader\simpleblogreader\dateconverter.h	6	1	SimpleBlogReader

    But the fourth parameter to the DateConverter::Convert and ConvertBack member functions is named culture, so I changed it to language, as indicated in the error message, and it compiled fine (from DateConverter.h):

    virtual Platform::Object^ Convert(Platform::Object^ value,
        Windows::UI::Xaml::Interop::TypeName targetType,
        Platform::Object^ parameter,
        Platform::String^ language) // <= new name
    {
        // ... 
    }

    It is perfectly legitimate in C++ (or most languages that support polymorphism) for names of parameters to differ when overridden. Apparently Microsoft, as usual, thinks they know better.

    Anyway, this is how you get around the problem.


    • Proposed as answer by redmenace07 Tuesday, September 11, 2012 7:48 PM
    • Edited by redmenace07 Tuesday, September 11, 2012 7:49 PM
    • Marked as answer by Jesse Jiang Monday, October 8, 2012 6:26 AM
    • Unmarked as answer by Jesse Jiang Monday, October 8, 2012 6:27 AM
    Tuesday, September 11, 2012 7:48 PM
  • Yeah, what it the point in this "error"? Why is it here? Can someone who knows it reply?

    So we are disallowed to change parameter names whenever we have ref class inherited from some interface? Why?

    Saturday, September 22, 2012 8:03 AM
  • Just downloaded simpleblogreader and tried to build it - got 6 error messages - beginning with DateConverter problems

    Error 1 The type 'local:DateConverter' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. C:\Users\phb\Downloads\Getting started with C%2b%2b simple blog reader sample\C++\MainPage.xaml 21 10 SimpleBlogReader
    Error 2 The name "DateConverter" does not exist in the namespace "using:SimpleBlogReader". C:\Users\phb\Downloads\Getting started with C%2b%2b simple blog reader sample\C++\MainPage.xaml 21 9 SimpleBlogReader
    Error 3 The name "DateConverter" does not exist in the namespace "using:SimpleBlogReader". C:\Users\phb\Downloads\Getting started with C%2b%2b simple blog reader sample\C++\App.xaml 1 1 SimpleBlogReader
    Error 4 The name "FeedDataSource" does not exist in the namespace "using:SimpleBlogReader". C:\Users\phb\Downloads\Getting started with C%2b%2b simple blog reader sample\C++\App.xaml 1 1 SimpleBlogReader
    Error 5 The name "FeedData" does not exist in the namespace "using:SimpleBlogReader". C:\Users\phb\Downloads\Getting started with C%2b%2b simple blog reader sample\C++\App.xaml 1 1 SimpleBlogReader
    Error 6 error D8038: invalid argument 'C:\Users\phb\Downloads\Getting started with C%2b%2b simple blog reader sample\C++\Generated Files\' C:\Users\phb\Downloads\Getting started with C%2b%2b simple blog reader sample\C++\cl SimpleBlogReader

    Wednesday, November 7, 2012 10:06 AM
  • Well, I am also stucked with this problem.

    Fortunately, redmanece07's answer solved the problem, but I really don't know why..

    As to "the name dateconverter does not exist in the namespace "using:SimpleBlogReader", I think is because the dateconverter.h does not pass the compilation. So the Main.xaml can not recognize it. And I also have the same question, does this mean we can not change the name of a parameter when we want to inherite from other classes or interfaces? If so, I think this must be fixed immediately, it violates basic role of C++.

    Thursday, November 8, 2012 8:58 AM
  • I encountered a similar problem in terms of an error message in the XAML editor saying invalid markup and item in Error List saying the name "DateConverter" does not exist, though in my case I had correctly used 'language' as the parameter name and the app did successfully build.

    Closing Visual Studio and reopening the Solution resolved the issue.


    will stott

    Sunday, February 24, 2013 1:49 PM