This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

iostream


Hi everybody

I have problems with cygwin supporting iostream.h I
use g++ as compiler and I'm told to remove the .h
suffix from the header. doing so results in error
messages about unknown functions.
the test programm is:

#include 
main()
{
cout << "He's not the Messiah. He's a very naughty
boy" << endl;
}

resulting in:
  
In file included from
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/backward/iostream.h:31,
                 from test.cc:1:
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/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 
header for the  header for C++ includes, or
 instead of the deprecated header
. To disable this warning use
-Wno-deprecated.
test.cc:5:2: warning: no newline at end of file

using  returns:

test.cc: In function `int main()':
test.cc:4: error: `cout' undeclared (first use this
function)
test.cc:4: error: (Each undeclared identifier is
reported only once for each function it appears in.)
test.cc:4: error: `endl' undeclared (first use this
function)
test.cc:5:2: warning: no newline at end of file

I really searched the mailing list, the web etc. the
advice below doesn't help me since I Do use g++ and a
cc-suffix.

thanks for any advise
matthias

    I believe this is in the gcc FAQ. However, it's
been asked often enough
    > > on this list, so here's an answer for the
archives:
    > >
    > > gcc uses the file extension to determine the
language. Any extension it
    > > doesn't recognize is assumed to be a C file.
The default extension for a
    > > C++ file is ".C". gcc does not recognize
".cxx", which is used by
    > > Microsoft compilers, I think. It is, of
course, possible to tell gcc to
    > > treat a ".cxx" file as a C++ file. In case you
don't want to mess with
    > > the gcc configuration, use either the "-x c++"
option of gcc, or simply
    > > call g++.
    > > Igor
    >
    > Hmm, I suppose I better correct myself before
someone else does...
    > The default extensions (suffixes) for C++ are
".C", ".cc", ".cpp", and
    > ".cxx". Any suffix that is not recognized (e.g.,
".o" and ".a") is passed
    > directly to the linker.

    What's wrong with me today? :-(
    Please strike the ".cpp" suffix. The above should
read:
    The default suffixes for C++ are ".C", ".cc", and
".cxx".

your 'mistake' was understandable, since ".C", ".cc",
".cxx", ".cp", ".cpp" and".c++". are all considered
c++ in gcc 3.0 and up. (although the person in this
question is obviously using <3.0 since they got it to
compile :P)

Gareth


 
____________________________________________________________________________________
Cheap talk?
Check out Yahoo! Messenger's low PC-to-Phone call rates.
http://voice.yahoo.com

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]