#include <string> problem with g++ in latest(?) version of cygwin

Charles Plager cplager+response@physics.ucla.edu
Tue Apr 8 15:37:00 GMT 2003


I am running on Windows XP pro (sp 1) with the latest version of cygwin 
(I don't know how to check which version; I installed it last week).

The problem is that the following C++ code doesn't compile with g++ on 
cygwin when it does on linux (and on alphas, suns, etc).

--tryMap.cc--
// -*- C++ -*-
#include <iostream>
#include <string>

int main ()
{
    string first = "this is the first test";
    std::cout << first << std::endl;
    return 0;
}


cplager@pointyjr> g++ tryMap.cc
tryMap.cc: In function `int main()':
tryMap.cc:7: `string' undeclared (first use this function)
tryMap.cc:7: (Each undeclared identifier is reported only once for each
    function it appears in.)
tryMap.cc:7: parse error before `=' token
tryMap.cc:8: `first' undeclared (first use this function)


If I replace '#include <string>' with '#include <nosuchinclude>'
I get:
tryMap.cc:3:25: nosuchinclude: No such file or directory

which seems to mean that its finding string.h and just doesn't know what 
to do with it (or something like that).
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cygcheck.out
URL: <http://cygwin.com/pipermail/cygwin/attachments/20030408/145aca89/attachment.ksh>
-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list