This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
libstdc++/5825: std::__basic_file not compilable
- From: Axel dot Zeuner at systor dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 4 Mar 2002 09:08:48 -0000
- Subject: libstdc++/5825: std::__basic_file not compilable
- Reply-to: Axel dot Zeuner at systor dot com
>Number: 5825
>Category: libstdc++
>Synopsis: std::__basic_file not compilable
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Mar 04 01:16:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Axel Zeuner
>Release: GNU C++ version 3.1 20020302 (prerelease) (i686-pc-linux-gnu)
>Organization:
>Environment:
Debian Woody Prerelease
>Description:
Not compilable std::ofstream because of missing define, probably a configuration bug.
// #define WORKAROUND
#if defined (WORKAROUND)
#define _GLIBCPP_BASIC_FILE_ENCAPSULATION 1
#endif
#include <fstream>
int main(int argc, char** argv)
{
if (argc < 2) {
return 1;
}
std::ofstream x(argv[1],std::ios::out);
x<<"Hello world"<<std::endl;
return 0;
}
Result:
End of search list.
In file included from /usr/local/gcc31/include/g++-v3/fstream:48,
from fstream.cc:5:
/usr/local/gcc31/include/g++-v3/bits/basic_file.h:135: '__c_wfile_type' is used
as a type, but is not defined as a type.
In file included from /usr/local/gcc31/include/g++-v3/bits/basic_file.h:262,
from /usr/local/gcc31/include/g++-v3/fstream:48,
from fstream.cc:5:
/usr/local/gcc31/include/g++-v3/i686-pc-linux-gnu/bits/basic_file_model.h: In
constructor `std::__basic_file<_CharT>::__basic_file(std::__c_lock*)':
/usr/local/gcc31/include/g++-v3/i686-pc-linux-gnu/bits/basic_file_model.h:39: class
`std::__basic_file<_CharT>' does not have any field named `_M_cfile'
/usr/local/gcc31/include/g++-v3/i686-pc-linux-gnu/bits/basic_file_model.h:39: class
`std::__basic_file<_CharT>' does not have any field named `_M_cfile_created'
>How-To-Repeat:
Compile the attached source.
>Fix:
#define _GLIBCPP_BASIC_FILE_ENCAPSULATION 1
before including <fstream>
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="fstream.cc"
Content-Disposition: inline; filename="fstream.cc"
// #define WORKAROUND
#if defined (WORKAROUND)
#define _GLIBCPP_BASIC_FILE_ENCAPSULATION 1
#endif
#include <fstream>
int main(int argc, char** argv)
{
if (argc < 2) {
return 1;
}
std::ofstream x(argv[1],std::ios::out);
x<<"Hello world"<<std::endl;
return 0;
}