locked
Tutorial - Create a blog reader Store app (C++) - Error:The name does not exist in the namespace!

    Question

  • I'm trying to create my first store app based on msdn's sample.

    Link to the sample:

    https://msdn.microsoft.com/pl-PL/library/windows/apps/hh465045.aspx

    I have problem doing last step (number 3) of part 3.

    In code below in file App.xaml the compiler get the error "The name 'FeedDataSource' does not exist in the namespace 'using:SimpleBlogReader'"

    <Application
        x:Class="SimpleBlogReader.App"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="using:SimpleBlogReader">
        
        <Application.Resources>
            <local:FeedDataSource x:Key="feedDataSource"/>
        </Application.Resources>
    
    </Application>

    In the file App.xaml.h I added line #include "FeedData.h", and FeedData.h  looks like:

    //feeddata.h
    
    #pragma once
    #include "pch.h"
    
    namespace SimpleBlogReader
    {
    	namespace WFC = Windows::Foundation::Collections;
    	namespace WF = Windows::Foundation;
    	namespace WUIXD = Windows::UI::Xaml::Documents;
    	namespace WWS = Windows::Web::Syndication;
    
    ...
    
    	/// <summary>
    	/// A FeedDataSource represents a collection of FeedData objects
    	/// and provides the methods to retrieve the stores URLs and download 
    	/// the source data from which FeedData and FeedItem objects are constructed.
    	/// This class is instantiated at startup by this declaration in the 
    	/// ResourceDictionary in app.xaml: <local:FeedDataSource x:Key="feedDataSource" /> 
    	/// </summary>
    	[Windows::UI::Xaml::Data::Bindable]
    	public ref class FeedDataSource sealed
    	{
    	private:
    		Platform::Collections::Vector<FeedData^>^ m_feeds;
    		FeedData^ GetFeedData(Platform::String^ feedUri, WWS::SyndicationFeed^ feed);
    		void DeleteBadFeedHandler(Windows::UI::Popups::UICommand^ command);
    
    	public:
    		FeedDataSource();
    		property Windows::Foundation::Collections::IObservableVector<FeedData^>^ Feeds
    		{
    			Windows::Foundation::Collections::IObservableVector<FeedData^>^ get()
    			{
    				return this->m_feeds;
    			}
    		}
    		property Platform::String^ CurrentFeedUri;
    
    		void InitDataSource();
    		void RetrieveFeedAndInitData(Platform::String^ url, WWS::SyndicationClient^ client);
    
    	};
    }
    How to solve this problem?

           

    Thursday, February 12, 2015 7:28 PM

Answers

  • You're testing this too early. You haven't yet finished writing code that your current code depends on. Feeddata.cpp won't build, so you can't use the data object that hasn't yet been created.

    In particular, feeddata.cpp doesn't build since it has many references to items which get added in later steps.

    For example, TextHelper is added in part 5 and App::RemoveFeed is added in part 10.

    You'll need to either wait until you've implemented those before you test or comment out the calls to the unimplemented features until they're done. TextHelper looks like it adds quite a bit and you're almost there, but you can probably get away with commenting out the calls to RemoveFeed and GetTitlesFromUri for now.

    Monday, February 16, 2015 11:59 PM
    Moderator

All replies

  • The code you posted looks correct. Are you seeing the error just in the designer or also at compile time? If just in the designer then build clean to make sure the FeedDataSource object gets built. You may also need to restart Visual Studio.

    If you still see the problem after rebuilding and restarting can you share your project on your OneDrive?

    Thursday, February 12, 2015 8:32 PM
    Moderator
  • I'm seeing the error in both situation. Claening and rebuilding nothing changes.

    Project as zip: click


    • Edited by bkdi Thursday, February 12, 2015 10:55 PM
    Thursday, February 12, 2015 10:38 PM
  • You're testing this too early. You haven't yet finished writing code that your current code depends on. Feeddata.cpp won't build, so you can't use the data object that hasn't yet been created.

    In particular, feeddata.cpp doesn't build since it has many references to items which get added in later steps.

    For example, TextHelper is added in part 5 and App::RemoveFeed is added in part 10.

    You'll need to either wait until you've implemented those before you test or comment out the calls to the unimplemented features until they're done. TextHelper looks like it adds quite a bit and you're almost there, but you can probably get away with commenting out the calls to RemoveFeed and GetTitlesFromUri for now.

    Monday, February 16, 2015 11:59 PM
    Moderator