Namespace Hilfe



  • #include <iostream>
    using namespace std;
    
    namespace AppVersion{
    	namespace Version1{
    		void whatsup() { cout << "Whatsup 1 Call" << endl; }
    		void display() { cout << "Display 1 Call" << endl; }
    	}
    	namespace Version2{
    		void whatsup() { cout << "Whatsup 2 Call" << endl; }
    		void display() { cout << "Display 2 Call" << endl; }
    	}
    
    	inline namespace Version3{
    		void whatsup() { cout << "Whatsup 3 Call" << endl; }
    		void display() { cout << "Display 3 Call" << endl; }
    	}
    }
    
    int main()
    {
    	AppVersion::display();
    
    	cin.get();
    }
    

    Wieso erzeugt dieser Code folgende Fehlermeldungen:
    Fehler 2 error C2143: Syntaxfehler: Es fehlt ';' vor 'namespace' c:\users\k\documents\visual studio 2013\projects\projekt1\projekt1\main.cpp 14 1 Projekt1
    Fehler 3 error C2039: 'display': Ist kein Element von 'AppVersion' c:\users\k\documents\visual studio 2013\projects\projekt1\projekt1\main.cpp 22 1 Projekt1
    Fehler 4 error C3861: "display": Bezeichner wurde nicht gefunden. c:\users\k\documents\visual studio 2013\projects\projekt1\projekt1\main.cpp 22 1 Projekt1

    ⚠
    Warnung 1 warning C4091: 'inline ': Ignoriert auf der linken Seite von 'int', wenn keine Variable deklariert wurde c:\users\k\documents\visual studio 2013\projects\projekt1\projekt1\main.cpp 14 1 Projekt1



  • Damit sagt dir VS 2013 "inline namespace kenn ich nich!"




Anmelden zum Antworten