[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] Hello world! virker ikke?



Daniel Udsen <sslug@sslug> writes:

> Jeg har et problem med mit hello world program det genrere en advarsel
> under kompileringen og out filen prestere ikke at printe Hello World!
> ud.
>
> Fejmedelelsen ser således ud:
> sslug@sslug ~/cpp $ g++  1st.cpp -o execfile
> In file included from /usr/include/c++/3.2.2/backward/iostream.h:31,
>                  from 1st.cpp:3:
> /usr/include/c++/3.2.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 <sstream> instead of
> the deprecated header <strstream.h>. To disable this warning use
> -Wno-deprecated.
>
> Programmet ser ca således ud: 
>
> // my first program in C++
>
> #include <iostream.h>
>
> int main ()
> {
>   cout << "Hello World!";
>   return 0;
> }

Som fejlbeskeden beskriver, skal du skifte din include ud.  Istedet
for <iostream.h> skal du bruge <iostream>.  Det vil dog betyde at cout
og endl ikke er i dit namespace.  En opdateret version ser således ud:


#include <iostream>

int main ()
{
  std::cout << "Hello World!" << std::endl;
  return 0;
}


Hvis du vil slippe for "std::" prefixes kan du tilføje følgende linie
lige efter include linien:

using namespace std;


/Esben
-- 
Ever wonder if illiterate people get the full effect of alphabet soup?
                                                                - John Mendoza


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:09 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *