Gilad Nevo gn.nevo at gmail.com
Ons Feb 14 07:26:23 GMT 2007


Tja
har testat din kod och det är inga problem att få ut Test.

Men när jag remmade:
 //#include <iostream.h> fick jag samma fel. Vilket innebär att cout samt
endl är fördeklarearde funktioner som finns i iostream.h. Hittar den inte
iostream.h funkar inget. kör om installationen av C++.

-------------------min kod---din kod---------
#include <iostream.h>
#include <stdlib.h>

int main()
{
        cout << "Test" << endl;
        system("PAUSE");
        return 0;
}
------------------------slut--------------

Ha dé
/Gilad





Den 2007-02-11 skrev Peter <peter at saol.no-ip.com>:
>
> Hej.
> Sitter och försöker lära mig lite C++ programmering och får lite konstigt
> resultat. Koden jag kompilerar är följande med namnet test.cpp (raderna
> med START och SLUT är inte med)
>
> --- START---
> #include <iostream.h>
>
> int main()
> {
>         cout << "Test" << endl;
>         return 0;
> }
>
> ---SLUT---
>
> När jag kompilerar test.cpp med "g++ test.cpp -o test" från kommandoraden
> får jag följande meddelande
>
> --- KLIPP --- g++ test.cpp -o test
> In file included from
> /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/backward/iostream.h:31,
>                  from test.cpp:1:
> /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/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 <iostream> instead of the
> deprecated header <iostream.h>. To disable this warning use
> -Wno-deprecated.
>
>  --- KLIPP ---
>
> När jag sedan försöker använda enbart #include <iostream>  får jag
> följande meddelande:
>
> --- KLIPP---
> test.cpp: In function 'int main()':
> test.cpp:5: error: 'cout' was not declared in this scope
> test.cpp:5: error: 'endl' was not declared in this scope
> --- KLIPP---
>
> Jag har kollat så filen iostream finns i /usr/include/c++/4.1.2 men något
> är fel???
>
> Är det någon som har tips om vad som kan vara fel?
>
>
> // Peter
>
>
> --
> ubuntu-se mailing list
> ubuntu-se at lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-se
>
>
-------------- next part --------------
En HTML-bilaga skiljdes ut...
URL: https://lists.ubuntu.com/archives/ubuntu-se/attachments/20070214/29581aa0/attachment.htm 


More information about the ubuntu-se mailing list