NOOB Frage :/



  • Hi Leute!
    Habe folgendes Programm geschrieben >>

    #include <iostream.h>
    void main()
    {   
        // Dies ist das Hello World Programm
        cout<<"Hello World!"<<endl;
    };
    

    und bekomme diese Meldung vom Compiler >>

    uilding Makefile: "C:\Dev-Cpp\Makefile.win"
    Führt  make... aus
    make.exe -f "C:\Dev-Cpp\Makefile.win" all
    g++.exe -c main.cpp -o main.o -I"C:/Dev-Cpp/include/c++/3.3.1"  -I"C:/Dev-Cpp/include/c++/3.3.1/mingw32"  -I"C:/Dev-Cpp/include/c++/3.3.1/backward"  -I"C:/Dev-Cpp/lib/gcc-lib/mingw32/3.3.1/include"  -I"C:/Dev-Cpp/include"   
    
    In file included from C:/Dev-Cpp/include/c++/3.3.1/backward/iostream.h:31,
                     from main.cpp:1:
    C:/Dev-Cpp/include/c++/3.3.1/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <sstream> instead of the deprecated header <strstream.h>. To disable this warning use -Wno-deprecated.
    main.cpp:3: error: `main' must return `int'
    
    make.exe: *** [main.o] Error 1
    
    Ausführung beendet
    

    Worin besteht der Fehler? Schonmal Danke für die Hilfe!!! 🙂

    mfg. sTrykA



  • #include <iostream> // iostream.h ist veraltet
    int main() // main() hat als Rückgabewert int
    {  
        std::cout<<"Hello World!"<< std::endl; // cout und endl liegen nun im std Namespace
    }
    

    Hier was zum lesen.

    Einmal reicht.
    http://www.c-plusplus.net/forum/viewtopic.php?t=88134
    http://www.c-plusplus.net/forum/viewtopic.php?t=88139



  • Oder man hätte einfach mal die Compilerausgabe durchlesen sollen

    error: `main' must return `int'
    warning: #warning This file includes at least one deprecated or antiquated header. [...] Examples include substituting the <X> header for the <X.h> header

    😉


Anmelden zum Antworten